-
Testing
Write unit tests for my critical business logic
Generate focused unit tests for the functions that handle money, auth, and data integrity before you launch.
Free Prompt
I'm about to launch my app and I need unit tests covering the business logic that would hurt the most if it broke.
First, scan my codebase and identify the functions that handle: payments and price calculations, authentication and session logic, authorization checks (who can access what), and any data transformations that write to the database. List what you find before writing anything so I can confirm the priorities.
Then, for each critical function, write unit tests that cover:
1. The happy path with realistic input.
2. Empty, null, or undefined input.
3. Malformed input (wrong types, oversized values, unexpected shapes).
4. Boundary conditions (zero, negative numbers, maximum values).
5. Any branching logic where a wrong branch would charge the wrong amount, leak data, or grant access it shouldn't.
Use the test framework already in my project. If there isn't one, tell me which one you'd recommend for my stack and wait for my confirmation before adding it.
Don't mock the entire world. Only mock external services (payment providers, email, third-party APIs). Let the real logic run. Don't write tests that just assert the mock was called.
When you're done, show me how to run the tests and confirm they all pass. If any test fails against the current code, stop and show me the failure before changing the implementation, because a failing test on launch eve might be a real bug.
What This Does / How This Helps
This generates unit tests for the parts of your app where a bug costs money, leaks data, or locks users out. It starts by inventorying your critical functions so you can sanity-check the priorities before any test code gets written. Most vibe-coded apps ship with zero tests, which means every refactor after launch is a coin flip. A small suite covering the dangerous paths catches regressions when you're moving fast and tired. The instruction to avoid mock-heavy tests matters: a test that only verifies a mock ran proves nothing about your actual code.
Want to skip doing this by hand?
Fortivibe audits your app for all of the areas these prompts cover (and more).