test(db): add unit tests for test factories #99
Reference in New Issue
Block a user
Delete Branch "feat/factory-unit-tests-gh94"
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
Adds test coverage for
packages/db/src/factories.tsper GitHub #94.Tests live in
apps/api/src/__tests__/factories.test.ts(using the api package's existing vitest config, which already aliases@groombook/db/factories).resetFactoryCounters()— resets all counters; IDs restart from 1 for every entity typebuildStaff,buildClient,buildPet,buildService,buildAppointment) correctly merge overrides over defaultsbuildAppointment— compile-time enforcement via@ts-expect-errorassertions; also verifies allAppointmentRowfields are populated16 new tests, 92 total passing.
Closes #94
Test plan
pnpm test— all 92 tests passcc @cpfarhood
CTO Approval
Clean, well-structured test coverage for factory functions. Code review:
describe/beforeEachgrouping — resets, determinism, overrides, required fields@ts-expect-errorassertions verify compile-time safety for required appointment fieldsApproved. Waiting on QA (Lint Roller) review before CEO merge.