skills/mav-bp-unit-testing/SKILL.md
Unit testing conventions for applications. Covers test design, isolation, structure, mocking discipline, and project testing guidance. Applied when writing or reviewing unit tests.
npx skillsauth add thermiteau/maverick-private mav-bp-unit-testingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Ensure unit tests are meaningful, fast, and maintainable. Tests verify behaviour, not implementation.
Every test follows three phases:
One act per test. If you need multiple acts, you need multiple tests.
| Type | Purpose | When to use | | ---- | ------- | ----------- | | Stub | Returns canned data | Replace a dependency that provides input to the unit | | Mock | Verifies interactions | Verify the unit calls a dependency correctly (use sparingly) | | Fake | Simplified implementation | Replace complex infrastructure (in-memory DB, fake HTTP server) | | Spy | Records calls to real implementation | Verify a side effect while keeping real behaviour |
should return empty array when no items match filterdescribe blocksdescribe('functionName', () => { it('should [behaviour] when [condition]') })Before applying these standards, load the project-specific testing implementation:
digraph lookup {
"docs/maverick/skills/unit-testing/SKILL.md exists?" [shape=diamond];
"Read and use alongside these standards" [shape=box];
"Invoke upskill" [shape=box];
"Read generated skill" [shape=box];
"docs/maverick/skills/unit-testing/SKILL.md exists?" -> "Read and use alongside these standards" [label="yes"];
"docs/maverick/skills/unit-testing/SKILL.md exists?" -> "Invoke upskill" [label="no"];
"Invoke upskill" -> "Read generated skill";
"Read generated skill" -> "Read and use alongside these standards";
}
docs/maverick/skills/unit-testing/SKILL.mdupskill skill with:
describe\(|it\(|test\(|expect\(|assert|@Test|func Test**/*.test.*, **/*.spec.*, **/test_*.*| Pattern | Issue | Fix | | ------- | ----- | --- | | Test with no assertions | False confidence | Add meaningful assertions | | Mocking internal modules | Brittle tests | Mock at boundaries only | | Test name describes implementation | Couples to internals | Describe behaviour instead | | Shared mutable state between tests | Test pollution | Use beforeEach/factory functions | | Test catches and swallows errors | Hidden failures | Let errors propagate or assert on them | | >3 mocks in one test | Unit has too many dependencies | Refactor the unit's design | | Test duplicates implementation logic | Tautological test | Assert on outputs, not reimplemented logic | | Commented-out tests | Dead tests hiding failures | Delete or fix |
development
Use when a best-practice skill needs project-specific implementation details and no project skill exists at docs/maverick/skills/<topic>/SKILL.md. Scans the codebase and generates a project-specific skill file.
testing
Create or update technical documentation for a project. Covers architecture, service interactions, data flows, and design decisions. Produces professional markdown with Mermaid diagrams.
development
How to process code review feedback — verify before implementing, push back when wrong, clarify before acting on partial understanding. Applied when receiving review from the code-reviewer agent or human reviewers.
development
Analyze a project's codebase against Maverick standard practices and write a findings report. Checks linting, unit tests, integration tests, documentation, and CI/CD. Run when onboarding an existing project or on demand.