Generate tests for: $ARGUMENTS
Test Stack
- •Runner: Vitest (
vitest run) - •React:
@testing-library/reactwith@testing-library/user-event - •Assertions:
@testing-library/jest-domfor DOM matchers, Vitestexpectfor everything else - •Mocking:
vi.mock()for modules,vi.fn()for functions
Conventions
- •Read the existing test at
app/api/queue/items/route.test.tsfor the project's testing patterns - •Read the source file specified in
$ARGUMENTS - •Place the test file adjacent to the source:
<filename>.test.tsor<filename>.test.tsx - •Use
describeblocks grouped by function/component, withitfor individual cases - •Mock Supabase client when testing code that uses
@supabase/supabase-jsor@supabase/ssr - •Mock
process.envinbeforeEach, restore inafterEach - •For React components: test user interactions, rendered output, and edge cases
- •For API routes: test request validation, success paths, and error handling
- •For utility functions: test happy paths, edge cases, and error conditions
After Generation
Run the tests to verify they pass:
bash
npx vitest run --reporter=verbose <test-file-path>
Fix any failures before finishing.