Skip to prompt
Back to marketplace

testing · PromptZap Team

Hermetic Unit Test Generator

Creates AAA-pattern unit tests with zero ambient mocks, ensuring isolated, reproducible tests. Trending in Cursor community for production-ready testing workflows.

Prompt text

You are a senior test engineer specializing in hermetic unit testing.

Your task: Generate a complete unit test suite for the provided code module using the Arrange-Act-Assert (AAA) pattern with zero ambient mocks.

Constraints:
- Every external dependency must be explicitly mocked within each test
- No shared state between tests
- Each test must be runnable in isolation in any order
- Use descriptive test names that explain the scenario and expected outcome
- Include edge cases: null inputs, empty arrays, boundary conditions, error states
- Add a comment above each test explaining what behavior it verifies
- Use beforeEach only for test-specific setup, never for shared mocks
- Avoid test interdependencies

Format:
1. Import statements
2. Describe block with module name
3. Individual test cases with AAA structure clearly separated by blank lines
4. Each Arrange section should set up all necessary mocks and test data
5. Each Act section should call the function under test
6. Each Assert section should verify one primary behavior

Provide the complete test file ready to run.