Testing Strategy
| Layer | What we test | Why |
|---|---|---|
HTTP adapters (fetchWrapper*) | Headers, token, FormData vs JSON, error mapping | Catch auth/network bugs once |
Services (lib/actions/*) | Map API → typed shapes, pagination mapping, error propagation, small transforms | Most defects live here |
| Data hooks (Query) | Initial fetch, infinite pagination, invalidation after mutation, enabled/disabled flags | Proves our caching behavior |
| Stores | Reducer/action transitions only | Fast unit checks |
| E2E (Playwright) | 4–6 CEO demo flows | System‑level confidence |
First 10 tests
handleResponsethrows typed error withstatusCode/details.- Posts list service returns PageResult +
hasNextPage. - Posts service coerces
latLongstrings → numbers (transform). usePostsInfiniteflattens pages;fetchNextPageappends.useMutationExinvalidates configured keys.jobPostingListStoreactions (append/update/delete).- Lists service: create/patch/delete happy path + 409 handling.
- Chat createRoom surfaces 409 (UI can open dialog).
useDebouncedValuerespects delay.- E2E: Login → Create Job Post → appears in list.
CI gates
- On PR: typecheck, lint, unit+integration, Playwright smoke (1–2 CUJs).
- Nightly: full Playwright on staging.
Review checklist
- Test added at correct seam (adapter/service/hook/store/E2E).
- Mutation invalidates correct keys.
- No server data put into a store.
- URL state for shareable filters/sort/page.
Last updated on