Share

Prompt that makes Cursor write tests that test something

Open · 8 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

Activity