Files
FlockPal/docs/WEIGHT_REMINDER_TESTING.md
blaisadmin b1b89ad334
Deploy / deploy-dev (push) Successful in 2m44s
Deploy / deploy-prod (push) Skipped
Fixed email designs
2026-09-08 20:49:59 -04:00

1.6 KiB

Weight reminder tests

From the repository root, run the unit tests and builds:

npm ci --prefix backend
npm ci --prefix frontend
npm test --prefix backend
npm run build --prefix backend
npm run build --prefix frontend

The integration test uses real Postgres 16, Redis 7, two worker processes, and Mailpit to capture SMTP messages locally. It requires Docker and free localhost ports 25432, 26379, 21025, and 28025. Port 21026 must remain unused for the SMTP failure check. Test addresses use .test; Mailpit does not relay mail externally.

docker compose -p flockpal-weight-test -f backend/test-integration/compose.weight-reminders.yml up -d --wait
node backend/test-integration/weightReminders.mjs
docker compose -p flockpal-weight-test -f backend/test-integration/compose.weight-reminders.yml down --volumes

Always run the last command when finished, including after a failed test. Start fresh containers for each run. Postgres data is disposable and held in tmpfs. The test overrides database, Redis, and SMTP environment variables to use only these local services. It does not use the application's configured SMTP account.

Coverage includes repeatable schema initialization, overdue and recent weights, birds without weights, memorial exclusions, accepted care roles, concurrent claims, one daily job across two workers, removal of the old five-minute schedule, grouped emails, embedded branding and portraits, HTML escaping, flock isolation, daily repeats, fresh weight resets, SMTP failures and recovery, worker shutdown, and disabling the scheduler. Repeat timing is tested by aging delivery timestamps rather than waiting two days.