test: add comprehensive tests for match management, data structures, and API endpoints#928
Merged
Olowodarey merged 1 commit intoJun 2, 2026
Conversation
…and API endpoints Issue Arena1X#822 — Add data_structures_test.rs (46 unit tests) - MatchResult: to_u8/from_u8/from_u32 round-trip and edge cases - Event: validate (empty, too-long title/desc), can_accept_participants, add_participant (deactivated, full), add_match, get_age_seconds - Match: time_since_result, get_winner (all variants, none), allows_predictions (result blocks, cutoff), has_started, is_ready_for_result, time_until_start, validate (team names, submitted_by/at, winning_team) - Prediction: validate_outcome, grade (correct/wrong), is_before_match_time - Winner: accuracy_percentage (rounding, edge cases), outranks (correct count, tiebreak, same stats, zero-correct) Issue Arena1X#826 — Enhance match_tests.rs (29 tests, +25 new) - add_match: stores correctly, updates event match list, increments event count, increments global counter, cancelled event doesn't affect existing, validates team names (empty, uniqueness, length boundary) - get_match: existing returns correctly, non-existent returns error, TTL extension, after result submission, multiple matches return correct one, storage returns error for invalid ID - list_event_matches: single, same-time, different events separately - get_match_count: increments after each add, independent across events - Future/past match time handling Issue Arena1X#764 — Add backend integration test suite (api-integration.e2e-spec.ts) - Health endpoints (/ping, /) - Markets pagination, filtering, public access - Users 404 for non-existent, auth guard testing - Leaderboard entries, pagination, history, public access - Creator events search, 404, empty query - Analytics categories, public access - Search results - Matches 404, public access - Response envelope format (success/error) - Error cases: unknown routes - Competition listing, filtering - Season list, active, public access - Match predictions 404 Issue Arena1X#765 — Add E2E critical flows test suite (critical-flows.e2e-spec.ts) - Season lifecycle: list all, active 404 - Admin operations: reject non-admin (403) - Oracle submission flow: pending matches, webhook result, submission history - Notification flow: fetch user notifications - Matches & predictions: non-existent 404 All Rust tests pass (46 data_structures + 29 match_tests) No compiler warnings introduced in test files Follows established NestJS test patterns (AppModule import + provider overrides)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was done
Issue File(s) Tests
#822 data_structures_test.rs (new) 46 unit tests — MatchResult, Event, Match, Prediction, Winner data structures
#826 match_tests.rs (enhanced) 29 tests (+25 new) — add_match, get_match, list_event_matches, get_match_count edge cases
#764 api-integration.e2e-spec.ts (new) Integration tests for health, markets, users, leaderboard, creator-events, analytics, search, matches, competitions, seasons, response envelope, error handling
#765 critical-flows.e2e-spec.ts (new) E2E tests for season lifecycle, admin ops (403), oracle submission, notification flow, matches/predictions
Verified
Closes #822 — data_structures_test.rs (46 unit tests)
Closes #826 — Enhanced match_tests.rs (29 tests)
Closes #764 — API integration test suite
Closes #765 — E2E critical flows test suite