Files
FlockPal/docs/WEIGHT_REMINDER_TESTING.md
T
blaisadmin 5abc7f6174
Deploy / deploy-dev (push) Successful in 2m15s
Deploy / deploy-prod (push) Skipped
Added missing weight emails
2026-09-05 22:51:39 -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 scheduler across two workers, grouped emails, HTML escaping, flock isolation, 48-hour 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.