Demo, all content is generated
Share

Prompt that makes Cursor write tests that test something

Open · 168 views · asked by dev_ana · edited

Cursor loves mocking the thing under test. This prompt forces it to name what the test observes first.

Prompt
Copied 15 times
Write a test for [component/hook]. Before writing code, list in one line each:
1. What the user does (render, click, type, wait).
2. What must be visible or called afterwards.
Then write the test using those observations. Do not mock [component/hook] itself. You may mock timers and network.
If the implementation were deleted, the test must fail.
Comment
Tried it on my countdown hook. It listed the observations first, and the test actually failed when I broke the code. rosa_m · edited

Activity