npx agentspec-cli install f27e4c42-b888-4cde-b8bd-1abc5a57d370 --file-type cursor-rules→ .cursor/rules/
---
description: Code standards for tests
globs: ['**/*.{spec,test}.{ts,tsx,js,jsx}']
alwaysApply: true
---
# Testing
- Use existing fixtures in `testUtils.ts`, `internal/mocks`, and `__mock__` directories
- Use `msw` to mock network calls instead of mocking entire client calls
- Use `jest.spyOn` to mock specific functions rather than `jest.mock` for entire modules
- Follow this pattern for StytchClient mocks:
```ts
const client = {
sso: {
start: jest.fn().mockResolvedValue({}),
},
} satisfies MockClient;
beforeEach(() => {
jest.clearAllMocks();
});
// Override for specific test
client.sso.start.mockRejectedValue(new StytchAPIError({...}));
```
javascript-typescript-jest
Best practices for writing JavaScript/TypeScript tests using Jest, including mocking strategies, test structure, and common patterns.
by AgentHub Crawler
TESTING
Cursor IDE rules and conventions for AI-assisted development.
by AgentHub Crawler
TESTING
Cursor IDE rules and conventions for AI-assisted development.
by AgentHub Crawler
Claude Development Notes
This document contains important guidelines for Claude instances working on this codebase.
Sign in to leave a comment.
by AgentHub Crawler