mirror of
https://github.com/wshobson/agents.git
synced 2026-03-18 09:37:15 +00:00
style: format all files with prettier
This commit is contained in:
@@ -39,21 +39,25 @@ Generate failing tests using Task tool with subagent_type="unit-testing::test-au
|
||||
## Framework Patterns
|
||||
|
||||
**JavaScript/TypeScript (Jest/Vitest)**
|
||||
|
||||
- Mock dependencies with `vi.fn()` or `jest.fn()`
|
||||
- Use `@testing-library` for React components
|
||||
- Property tests with `fast-check`
|
||||
|
||||
**Python (pytest)**
|
||||
|
||||
- Fixtures with appropriate scopes
|
||||
- Parametrize for multiple test cases
|
||||
- Hypothesis for property-based tests
|
||||
|
||||
**Go**
|
||||
|
||||
- Table-driven tests with subtests
|
||||
- `t.Parallel()` for parallel execution
|
||||
- Use `testify/assert` for cleaner assertions
|
||||
|
||||
**Ruby (RSpec)**
|
||||
|
||||
- `let` for lazy loading, `let!` for eager
|
||||
- Contexts for different scenarios
|
||||
- Shared examples for common behavior
|
||||
@@ -93,6 +97,7 @@ Generate failing tests using Task tool with subagent_type="unit-testing::test-au
|
||||
## Validation
|
||||
|
||||
After generation:
|
||||
|
||||
1. Run tests - confirm they fail
|
||||
2. Verify helpful failure messages
|
||||
3. Check test independence
|
||||
@@ -102,7 +107,7 @@ After generation:
|
||||
|
||||
```typescript
|
||||
// auth.service.test.ts
|
||||
describe('AuthService', () => {
|
||||
describe("AuthService", () => {
|
||||
let authService: AuthService;
|
||||
let mockUserRepo: jest.Mocked<UserRepository>;
|
||||
|
||||
@@ -111,23 +116,23 @@ describe('AuthService', () => {
|
||||
authService = new AuthService(mockUserRepo);
|
||||
});
|
||||
|
||||
it('should_return_token_when_valid_credentials', async () => {
|
||||
const user = { id: '1', email: 'test@example.com', passwordHash: 'hashed' };
|
||||
it("should_return_token_when_valid_credentials", async () => {
|
||||
const user = { id: "1", email: "test@example.com", passwordHash: "hashed" };
|
||||
mockUserRepo.findByEmail.mockResolvedValue(user);
|
||||
|
||||
const result = await authService.authenticate('test@example.com', 'pass');
|
||||
const result = await authService.authenticate("test@example.com", "pass");
|
||||
|
||||
expect(result.success).toBe(true);
|
||||
expect(result.token).toBeDefined();
|
||||
});
|
||||
|
||||
it('should_fail_when_user_not_found', async () => {
|
||||
it("should_fail_when_user_not_found", async () => {
|
||||
mockUserRepo.findByEmail.mockResolvedValue(null);
|
||||
|
||||
const result = await authService.authenticate('none@example.com', 'pass');
|
||||
const result = await authService.authenticate("none@example.com", "pass");
|
||||
|
||||
expect(result.success).toBe(false);
|
||||
expect(result.error).toBe('INVALID_CREDENTIALS');
|
||||
expect(result.error).toBe("INVALID_CREDENTIALS");
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user