# Jest

> Jest 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.

- Skill name: `jest`
- Category: [Testing & Quality](https://www.openparable.com/skill/testing-quality/1)
- Source: https://github.com/a5c-ai/babysitter/blob/HEAD/library/specializations/web-development/skills/jest/SKILL.md
- Repository: a5c-ai/babysitter (1,548 GitHub stars when collected)

## SKILL.md

# 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

```typescript
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

---

Source: https://www.openparable.com/skill/testing-quality/jest (OpenParable). Cite the canonical URL above.
