Skip to content

AdminService has no unit tests: user management and fraud actions are uncovered #1086

Closed

Description

@nanaf6203-bit

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

  1. 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.
  2. 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.

Activity

  1. oscar24357 commented on Aug 26, 2026

    @oscar24357

    @oscar24357 has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Hello boss, good evening, can you please assign this issue to me, thank you!

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @oscar24357 to this issue.

  2. egwujiohaifesinachiperpetual-max commented on Aug 26, 2026

    @egwujiohaifesinachiperpetual-max

    @egwujiohaifesinachiperpetual-max has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Please assign
    ETA is 4 hours

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @egwujiohaifesinachiperpetual-max to this issue.

  3. redman7712 commented on Aug 26, 2026

    @redman7712

    @redman7712 has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Hi Maintainer! I'm a senior developer with experience building high-quality, production-ready software. I'd love to take on this issue and deliver a clean, well-tested solution that aligns with the project's standards. Please assign it to me—I'm ready to get started and contribute effectively.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @redman7712 to this issue.

  4. shadrackmanfred commented on Aug 26, 2026

    @shadrackmanfred
    Contributor

    @shadrackmanfred has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Hi Maintainer! I'm a senior developer with experience building high-quality, production-ready software. I'd love to take on this issue and deliver a clean, well-tested solution that aligns with the project's standards. Please assign it to me—I'm ready to get started and contribute effectively.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @shadrackmanfred to this issue.

  5. drips-wave commented on Aug 26, 2026

    @drips-wave

    Congratulations, @shadrackmanfred! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on August 31, 2026.

    🧑‍💻 @shadrackmanfred: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  6. shadrackmanfred commented on Aug 28, 2026

    @shadrackmanfred
    Contributor

    Resolved on branch fix/type-safety-and-admin-tests (commit 1f932bf): added test/admin/admin.service.spec.ts with 27 unit tests covering user management, property moderation, transaction monitoring, fraud block/scan/review actions, backup delegation, and ADMIN-role guard metadata. admin.service.ts coverage: 96.7% statements / 68.1% branches.

  7. shadrackmanfred commented on Sep 1, 2026

    @shadrackmanfred
    Contributor

    Addressed by #1173.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions