You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NotificationsService has no unit tests: only the gateway spec exists
Labels / Complexity: testing · Medium Complexity — Medium
Problem
src/notifications/ has exactly one spec — notifications.gateway.spec.ts. The module's core, NotificationsService (which creates, delivers, and persists notifications across email/SMS/in-app channels), is untested. The SMS channel also carries the in-memory rate limiter (#55) whose behavior needs pinning before it is migrated. A regression in delivery selection or persistence ships silently.
Why this is architecturally hard
Channel selection is the test design. Notifications fan out to multiple channels based on user prefs; tests must pin which channels fire for which preferences.
Persistence + delivery are separate concerns. Tests should cover the Prisma write path (via test/database or mocks) and the transport dispatch (via transport stubs) independently.
The rate limiter must be pinned. With Input validation and sanitization #55 migrating the SMS rate limit, tests written now freeze the current window semantics so the migration cannot change them.
Acceptance criteria
Unit tests cover notification creation, channel selection, persistence, and delivery dispatch.
SMS rate-limit behavior (window, cap, reset) is pinned by tests.
Tests run in CI via npm test; the PR reports coverage via npm run test:cov.
Out of scope
The rate-limit durability migration (#55); notification behavior changes.
Getting started
src/notifications/notifications.service.ts — the core to cover
src/notifications/notifications.gateway.spec.ts — the existing spec style
Commands: npm test, npm run test:cov.
Good first files to read: src/notifications/notifications.service.ts, src/notifications/notifications.gateway.spec.ts.
NotificationsService has no unit tests: only the gateway spec exists
Labels / Complexity: testing · Medium Complexity — Medium
Problem
src/notifications/has exactly one spec —notifications.gateway.spec.ts. The module's core,NotificationsService(which creates, delivers, and persists notifications across email/SMS/in-app channels), is untested. The SMS channel also carries the in-memory rate limiter (#55) whose behavior needs pinning before it is migrated. A regression in delivery selection or persistence ships silently.Why this is architecturally hard
test/databaseor mocks) and the transport dispatch (via transport stubs) independently.Acceptance criteria
npm test; the PR reports coverage vianpm run test:cov.Out of scope
The rate-limit durability migration (#55); notification behavior changes.
Getting started
src/notifications/notifications.service.ts— the core to coversrc/notifications/notifications.gateway.spec.ts— the existing spec styleCommands:
npm test,npm run test:cov.Good first files to read:
src/notifications/notifications.service.ts,src/notifications/notifications.gateway.spec.ts.