Skip to content

fix(backend): admin 403 tests, search short-circuit, upcoming matches endpoint, tier boundary tests#1240

Merged
Olowodarey merged 1 commit into
Arena1X:mainfrom
euniceotowo:fix/1120-1121-1123-1131-backend-tests-and-upcoming-matches
Jun 27, 2026
Merged

fix(backend): admin 403 tests, search short-circuit, upcoming matches endpoint, tier boundary tests#1240
Olowodarey merged 1 commit into
Arena1X:mainfrom
euniceotowo:fix/1120-1121-1123-1131-backend-tests-and-upcoming-matches

Conversation

@euniceotowo

Copy link
Copy Markdown
Contributor

Summary

Resolves four backend issues in a single clean pass.

Changes

#1121 — SearchService short-circuit on short queries

  • Added guard at top of SearchService.search: queries shorter than 2 characters return an empty response without hitting any repository
  • Added unit tests: empty string "" and single char "a" both short-circuit (no DB call, total = 0)

#1123 — AdminController rejects non-admin users with 403

  • Added describe('AdminController — RolesGuard enforcement') block in admin.controller.spec.ts
  • Uses a real RolesGuard + Reflector to assert canActivate returns false for role='user' and true for role='admin' on:
    • GET /admin/dashboard/stats
    • GET /admin/users
    • PATCH /admin/users/:id/ban

#1131 — GET /creator-events/:id/matches/upcoming

  • Added getUpcomingMatches(eventId) to CreatorEventsService: queries DB for match_time > now AND result_submitted = false ORDER BY match_time ASC, throws 404 for unknown events
  • Added GET :id/matches/upcoming route to CreatorEventsController
  • Added unit tests: future matches returned, empty result, 404 on unknown event

#1120 — predictorTierFromReputation boundary values

  • All boundary tests (0, 199, 200, 499, 500, 999, 1000) were already present in analytics.service.spec.ts — no code changes needed, confirmed passing

Test results

Test Suites: 4 passed, 4 total
Tests:       53 passed, 53 total

Closes #1120
Closes #1121
Closes #1123
Closes #1131

…1131

- Arena1X#1120: boundary tests for predictorTierFromReputation already present (0,199,200,499,500,999,1000)
- Arena1X#1121: add short-query guard in SearchService.search (<2 chars → empty response, no DB hit) + unit tests
- Arena1X#1123: add RolesGuard enforcement tests to AdminController (403 for role=user, pass for role=admin on dashboard/stats, users, users/:id/ban)
- Arena1X#1131: add getUpcomingMatches() to CreatorEventsService + GET :id/matches/upcoming route + unit tests
@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
insight-arena-4rll Ready Ready Preview, Comment Jun 27, 2026 12:39pm

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@euniceotowo Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Olowodarey Olowodarey merged commit 0a1368a into Arena1X:main Jun 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment