โ Back to list

jest-testing-generator
by phatpham9
๐ Automated development environment setup for macOS and Ubuntu
โญ 5๐ด 2๐
Jan 18, 2026
SKILL.md
name: jest-testing-generator description: 'Generate Jest unit tests, integration tests, React Testing Library component tests, mock implementations, test fixtures, and edge case coverage for TypeScript codebases'
Purpose
Create comprehensive, maintainable Jest test suites for frontend and backend TypeScript code with proper mocking and edge case coverage.
When to Use
Use this skill when the task involves:
- Writing new unit or integration tests
- Adding tests for uncovered code paths
- Creating test fixtures and mock implementations
- Migrating from other test frameworks to Jest
- Improving test coverage metrics
Constraints
- Tests must be deterministic โ no random values, fixed timestamps
- Mock external dependencies at adapter boundaries, not deep in business logic
- Use React Testing Library for component tests (query by role/label, not test IDs)
- Prefer integration tests for API boundaries, unit tests for pure business logic
- Follow AAA pattern: Arrange, Act, Assert
- Name tests descriptively:
should [expected behavior] when [condition]
Execution Steps
- Analyze target โ Identify function/component inputs, outputs, and side effects
- Define test cases โ List happy paths, error cases, and edge cases
- Create fixtures โ Build reusable test data factories
- Write mocks โ Mock external dependencies (APIs, databases, time)
- Implement tests โ Write tests following AAA pattern
- Verify coverage โ Check uncovered branches and add missing tests
Examples
Input
Write tests for a UserService.register method that validates email and hashes password
Output
// @/modules/users/__tests__/users.service.spec.ts
import { Test } from '@nestjs/testing';
import { UsersService } from '../users.service';
import { UsersRepository } from '../users.repository';
import { ConflictException } from '@nestjs/common';
describe('UsersService', () => {
let service: UsersService;
let repository: jest.Mocked<UsersRepository>;
beforeEach(async () => {
const module = await Test.createTestingModule({
providers: [
UsersService,
{
provide: UsersRepository,
useValue: {
findByEmail: jest.fn(),
create: jest.fn(),
},
},
],
}).compile();
service = module.get(UsersService);
repository = module.get(UsersRepository);
});
describe('register', () => {
const validDto = {
email: 'test@example.com',
password: 'securePass123',
name: 'Test',
};
it('should create user when email is unique', async () => {
repository.findByEmail.mockResolvedValue(null);
repository.create.mockResolvedValue({ id: '1', ...validDto });
const result = await service.register(validDto);
expect(result.email).toBe(validDto.email);
expect(repository.create).toHaveBeenCalledWith(
expect.objectContaining({ email: validDto.email }),
);
});
it('should throw ConflictException when email exists', async () => {
repository.findByEmail.mockResolvedValue({ id: '1', ...validDto });
await expect(service.register(validDto)).rejects.toThrow(
ConflictException,
);
});
it('should hash password before storing', async () => {
repository.findByEmail.mockResolvedValue(null);
repository.create.mockResolvedValue({ id: '1', ...validDto });
await service.register(validDto);
expect(repository.create).toHaveBeenCalledWith(
expect.objectContaining({
password: expect.not.stringMatching(validDto.password),
}),
);
});
});
});
Related Skills
nest-backend-service-builderโ Service implementation patternsnextjs-react-engineeringโ Component testing patterns
Score
Total Score
65/100
Based on repository quality metrics
โSKILL.md
SKILL.mdใใกใคใซใๅซใพใใฆใใ
+20
โLICENSE
ใฉใคใปใณในใ่จญๅฎใใใฆใใ
+10
โ่ชฌๆๆ
100ๆๅญไปฅไธใฎ่ชฌๆใใใ
0/10
โไบบๆฐ
GitHub Stars 100ไปฅไธ
0/15
โๆ่ฟใฎๆดปๅ
3ใถๆไปฅๅ ใซๆดๆฐ
+5
โใใฉใผใฏ
10ๅไปฅไธใใฉใผใฏใใใฆใใ
0/5
โIssue็ฎก็
ใชใผใใณIssueใ50ๆชๆบ
+5
โ่จ่ช
ใใญใฐใฉใใณใฐ่จ่ชใ่จญๅฎใใใฆใใ
+5
โใฟใฐ
1ใคไปฅไธใฎใฟใฐใ่จญๅฎใใใฆใใ
+5
Reviews
๐ฌ
Reviews coming soon