test(students): add unit, integration and e2e tests for /students (#109) #137
Reference in New Issue
Block a user
Delete Branch "PMPR-109"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
tests/unit/students_test.ts): fixture shapes, mock API (GET/POST/PUT/DELETE, 400/404), mock DB CRUDtests/integration/students_test.ts): real DB viatestDb— list, filter by promo, create, get, update, delete, not-found casestests/e2e/students_test.ts): calls Fresh handlers directly with mockFreshContext+ real DB — covers auth (employee vs non-employee → 200 vs empty/403), 400/404 responsesAlso adds:
tests/helpers/handler.ts— shared utilities (makeEmployeeContext,makeContextWithAffiliation,makeGetRequest,makeJsonRequest) used by all future e2e testsdeno task test:e2etasktest.yml)Test plan
deno task test:unit— 37 passeddeno task test:integration— 11 passeddeno task test:e2e— 13 passedcloses #109