Jest
Testing & QualityjestJest is an Agent Skill for testing & quality published in the a5c-ai/babysitter repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Jest configuration, mocking strategies, snapshot testing, and coverage.
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/a5c-ai/babysitter/blob/HEAD/library/specializations/web-development/skills/jest/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/jest, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Jest Skill
Expert assistance for testing with Jest.
Capabilities
- Configure Jest for various frameworks
- Implement mocking strategies
- Write snapshot tests
- Configure coverage
- Handle async testing
Test Patterns
describe('UserService', () => {
let service: UserService;
let mockRepository: jest.Mocked<UserRepository>;
beforeEach(() => {
mockRepository = {
findAll: jest.fn(),
findById: jest.fn(),
create: jest.fn(),
};
service = new UserService(mockRepository);
});
it('should return all users', async () => {
mockRepository.findAll.mockResolvedValue([{ id: '1', name: 'John' }]);
const result = await service.findAll();
expect(result).toHaveLength(1);
expect(mockRepository.findAll).toHaveBeenCalled();
});
});
Target Processes
- unit-testing
- integration-testing
- tdd-development