📖 Step 7: Testing & Quality#187 / 291
Unit Test
Unit Test
📖One-line summary
A test that checks a single function or component in isolation.
✨Example
Test a single function in isolation
describe("add function")
○add(2, 3)→ 5
○add(-1, 1)→ 0
○add(0, 0)→ 0
⚡Vibe coding prompt examples
>_
Write unit tests with Jest for the cart total calculation function. Include discount, quantity change, and empty cart cases.
>_
Write unit tests for a React component with Testing Library. Test button click, input, and conditional rendering.
Try these prompts in your AI coding assistant!