Cursor prompt
Write Test Suite from Scratch
Generate a comprehensive unit and integration test suite for a module with mocking, fixtures, and CI-ready configuration.
Write a complete test suite for the following module. ## Module: {{module_name}} ## Test Framework: {{test_framework}} ## Code to Test: ```{{language}} {{code}} ``` ### Test Coverage Requirements **Unit Tests** - Each exported function in isolation with all valid inputs - Edge cases: empty arrays, zero values, null, undefined, boundary conditions - Error paths: thrown errors, rejected promises, invalid input rejection **Integration Tests** - Module interaction with {{dependencies}} - Database operations: create, read, update, delete, transactions - External API calls: mock with realistic fixture responses **Mocking Strategy** - Mock all external dependencies (DB, HTTP, file system) - Factory functions for test fixtures: createUser(), createProduct(), etc. - Reset all mocks in beforeEach to prevent test pollution **Test Quality Rules** - Descriptive names: "should [verb] when [condition]" - One assertion per test - No test interdependence — every test passes in isolation - Target > 90% branch coverage ### Output 1. All test files with complete test cases 2. Fixture factory functions 3. Test configuration additions needed 4. List of any edge cases intentionally excluded with explanation
Fill in: {{module_name}}, {{test_framework}}, {{language}}, {{code}}, {{dependencies}}. In Loopy you fill these in a form and copy the finished prompt in one click.

