Overview
Postiz uses a comprehensive testing strategy covering unit tests, integration tests, and end-to-end tests. This ensures code quality, prevents regressions, and maintains system reliability.Testing Stack
| Tool | Purpose | Usage |
|---|---|---|
| Jest | Unit & integration testing | Backend, shared libraries |
| Vitest | Fast unit testing | Alternative to Jest |
| Testing Library | React component testing | Frontend components |
| MSW | API mocking | Integration tests |
| Playwright | E2E testing | Full user flows |
Test Structure
Test Pyramid
Unit Tests
Backend Unit Tests
Test Services:auth.service.spec.ts
Frontend Unit Tests
Test Components:Button.test.tsx
usePosts.test.ts
Integration Tests
API Integration Tests
auth.controller.integration.spec.ts
Database Integration Tests
posts.repository.spec.ts
End-to-End Tests
Playwright E2E Tests
e2e/auth.spec.ts
Running Tests
Unit Tests
E2E Tests
Test Coverage
Generate Coverage Report
Coverage Targets
- Statements: 80%+
- Branches: 75%+
- Functions: 80%+
- Lines: 80%+
Best Practices
Next Steps
Contributing
Start contributing to Postiz
Code Standards
Follow code standards