# Testing Standards

> Write comprehensive tests following TDD and best practices. Use when generating unit tests, integration tests, or end-to-end tests for any code Use when this capability is needed.

- Skill: `tomevault-io/testing-standards-5` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/testing-standards-5`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/testing-standards-5/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/testing-standards-5

---


# Testing Standards Skill

## Test Structure (AAA Pattern)

```javascript
describe('Component/Function Name', () => {
  it('should do something specific', () => {
    // Arrange - Set up test data
    const input = { foo: 'bar' }
    
    // Act - Execute the code
    const result = functionUnderTest(input)
    
    // Assert - Verify results
    expect(result).toEqual(expectedOutput)
  })
})
```

## Test Categories

### Unit Tests
- Test single functions/methods
- Mock all dependencies
- Fast (<100ms per test)
- High coverage (80%+)

### Integration Tests
- Test component interactions
- Use test database
- Moderate speed
- Focus on critical paths

### E2E Tests
- Test complete user flows
- Use real browser
- Slower execution
- Test happy paths only

## Best Practices

1. **Descriptive Names**: `it('should return 401 when token is expired')`
2. **One Assert Per Concept**: Test one thing at a time
3. **Independent Tests**: No shared state between tests
4. **Use Factories**: Create test data with factories
5. **Mock External Services**: APIs, databases, file system

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/michelabboud) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-13 -->

