Skip to main content

Generate Pest Tests with Cursor

Premium
8:09

Comments & Discussion

PA
Pantelis Antoniadis ✓ Link copied!

at 07m35s: I like the idea to pass the query parameters as args and use the call() method:

$response = $this->call('GET', '/rooms/search', [
'check_in' => now()->addDay()->format('Y-m-d'),
'check_out' => now()->addDays(2)->format('Y-m-d'),
'guests' => 2,
]);

get() helper should be extended like the post() helper to pass query parameters as an array.

MS
Mike Scott ✓ Link copied!

The main reason developers don't write unit tests is because they write the code before the test and then can't be bothered adding tests afterwards. However, once one gets in the habit of writing tests first with a rapid red-green-refactor cycle, not only is the coding faster and more satisfying but one feels a lot more confident in the code AND the code will likely be far better structured than it would be if it was written without tests.

I would like to see how Cursor does using this test-driven style.

PK
Povilas Korop ✓ Link copied!

Would be an interesting experiment in the future, I agree.

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.