一键导入
testing-patterns
Testing patterns including AAA, mocking, and test data management. Use when writing unit tests, integration tests, or test suites.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Testing patterns including AAA, mocking, and test data management. Use when writing unit tests, integration tests, or test suites.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Aspire skill covering the Aspire CLI, AppHost orchestration, service discovery, integrations, MCP server, VS Code extension, Dev Containers, GitHub Codespaces, templates, dashboard, and deployment. Use when the user asks to create, run, debug, configure, deploy, or troubleshoot an Aspire distributed application.
Create ASP.NET Minimal API endpoints with proper OpenAPI documentation
Clean code principles for writing maintainable, readable code. Use when refactoring, code reviews, or writing new code to improve code quality.
Detailed coding standards and best practices including clean code, SOLID, and common patterns. Use when writing or reviewing code.
Containerize an ASP.NET Core project by creating Dockerfile and .dockerfile files customized for the project.
Create a README.md file for the project
| name | testing-patterns |
| description | Testing patterns including AAA, mocking, and test data management. Use when writing unit tests, integration tests, or test suites. |
| license | Apache 2.0 |
describe('UserService', () => {
describe('createUser', () => {
it('should create user with valid data', async () => {
// Arrange
const createDto = { email: 'test@example.com', name: 'Test' };
// Act
const result = await service.createUser(createDto);
// Assert
expect(result).toBeDefined();
expect(result.email).toBe(createDto.email);
});
});
});
const mockRepository = {
findById: jest.fn(),
create: jest.fn(),
} as jest.Mocked<UserRepository>;
mockRepository.findById.mockResolvedValue({ id: '123' });
const userFactory = {
valid: () => ({ email: 'test@example.com', name: 'Test' }),
withEmail: (email: string) => ({ ...userFactory.valid(), email }),
invalid: () => ({ email: 'invalid', name: '' }),
};
// Good: Describes scenario and expectation
it('should return 404 when user not found', async () => { ... });
it('should reject invalid email format', () => { ... });
// Bad
it('should work', () => { ... });