dodoguard / test
CLAUDE.md202 starsChanged 3 months agoMITView on GitHub
What this is: Jest-based test suite for core functionality (Vitest is used in frontend/ for the web app). ALWAYS use both flags: Mock cleanup is mandatory: Test entire objects, not individual fields: Mock minimally - Only mock external dependencies (APIs, databases), not code under test. Tests mirror src/ structure: Every provider needs: See test/providers/openai.test.ts for reference patterns. See .cursor/rules/jest.mdc for comprehensive Jest guidelines.
In this repository2 other files it gives its agents.
- drizzle/CLAUDE.mdCLAUDE.md
- examples/CLAUDE.mdCLAUDE.md
The file
We split this CLAUDE.md into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 19
Use .only() or .skip() in committed code
- Distinctive: line 20
Run watch mode in CI
- Distinctive: line 43
Mock minimally: - Only mock external dependencies (APIs, databases), not code under test.
- Very specific: line 67
Run from project root: npm test
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Test Suite
What this is: Jest-based test suite for core functionality (Vitest is used in frontend/ for the web app).
Critical Test Requirements
ALWAYS use both flags:
npm test -- --coverage --randomize--coverage- Required to track test coverage--randomize- Critical - Ensures tests don't depend on execution order
NEVER:
- Increase test timeouts - fix the slow test instead
- Use
.only()or.skip()in committed code - Run watch mode in CI
Project-Specific Testing Rules
Mock cleanup is mandatory:
afterEach(() => {
jest.resetAllMocks(); // Prevents test pollution
});Test entire objects, not individual fields:
// ✅ Good
expect(result).toEqual({ id: 1, name: 'test', active: true });
// ❌ Avoid
expect(result.id).toEqual(1);
expect(result.name).toEqual('test');Mock minimally - Only mock external dependencies (APIs, databases), not code under test.
Directory Structure
Tests mirror src/ structure:
test/providers/→src/providers/test/redteam/→src/redteam/- etc.
Provider Testing Pattern
Every provider needs:
- Success case (normal API response)
- Error cases (4xx, 5xx, rate limits)
- Configuration validation
- Token usage tracking
See test/providers/openai.test.ts for reference patterns.
Key Differences from Frontend Tests
- This uses Jest (not Vitest)
- Run from project root:
npm test - Uses
@jest/globalsimports - Different config:
jest.config.ts(not Vitest)
More Details
See .cursor/rules/jest.mdc for comprehensive Jest guidelines.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

