AdminService has no unit tests: user management and fraud actions are uncovered
Labels / Complexity: testing · Medium Complexity — Medium
Problem
src/admin/ has 9 files but only 2 specs, both in test/admin/ (backup.service.spec.ts, transaction-status.dto.spec.ts) — neither covers AdminService. The service implements the highest-privilege operations: user management, fraud blocking/scans, and content administration. None of it is pinned by tests, so a regression that lets an admin action misfire ships silently; with the admin e2e gap (#112), the module is unguarded at both levels.
Why this is architecturally hard
- Privilege escalation is the risk. Tests must pin that admin actions require the right role (guards) and that the service enforces its own checks — the defense-in-depth boundary.
- Fraud actions are stateful. Block/scan flows mutate user and alert state; tests need controlled fixtures asserting the resulting state transitions.
Acceptance criteria
- Unit tests cover user-management actions and at least one fraud action (block/scan) with role enforcement.
- Tests run in CI via
npm test; the PR reports coverage via npm run test:cov.
Out of scope
Admin e2e coverage (#112); admin behavior changes.
Getting started
src/admin/admin.service.ts — the service to cover
src/admin/admin.controller.ts — the routes and guards
Commands: npm test, npm run test:cov.
Good first files to read: src/admin/admin.service.ts, test/admin/backup.service.spec.ts.
AdminService has no unit tests: user management and fraud actions are uncovered
Labels / Complexity: testing · Medium Complexity — Medium
Problem
src/admin/has 9 files but only 2 specs, both intest/admin/(backup.service.spec.ts,transaction-status.dto.spec.ts) — neither coversAdminService. The service implements the highest-privilege operations: user management, fraud blocking/scans, and content administration. None of it is pinned by tests, so a regression that lets an admin action misfire ships silently; with the admin e2e gap (#112), the module is unguarded at both levels.Why this is architecturally hard
Acceptance criteria
npm test; the PR reports coverage vianpm run test:cov.Out of scope
Admin e2e coverage (#112); admin behavior changes.
Getting started
src/admin/admin.service.ts— the service to coversrc/admin/admin.controller.ts— the routes and guardsCommands:
npm test,npm run test:cov.Good first files to read:
src/admin/admin.service.ts,test/admin/backup.service.spec.ts.