Skip to content

feat: implement unit tests and creator event features#917

Open
djcdz4 wants to merge 1 commit into
Arena1X:mainfrom
djcdz4:main
Open

feat: implement unit tests and creator event features#917
djcdz4 wants to merge 1 commit into
Arena1X:mainfrom
djcdz4:main

Conversation

@djcdz4
Copy link
Copy Markdown

@djcdz4 djcdz4 commented May 30, 2026

Summary

  • [Backend] — Implement Unit Tests for Services #763 [Backend] — Added comprehensive unit tests for ContractService (all view functions, retry logic, RPC simulation), expanded tests for AnalyticsService (KPIs, streaks, market history, category analytics, user trends), and NotificationsService (CRUD, pagination filters, unread count). All tests mock external dependencies (Stellar SDK, TypeORM repositories).

  • [Frontend] — ENHANCEMENT: Add Create Creator Event Page at /creator-events/create #879 [Frontend] — Implemented /creator-events/create page with a 3-step multi-step form: event details (title, description, max participants), review & pay fee (XLM fee display, wallet check, transaction signing), and success (invite code display, copy/share buttons, redirect to matches). Includes localStorage draft persistence.

  • [Frontend] — ENHANCEMENT: Add Match Management Page at /creator-events/[id]/matches #881 [Frontend] — Implemented /creator-events/[id]/matches page with creator-only access guard, existing matches list (status badges, edit/delete actions), individual match add form (team names, future-datetime picker, duplicate detection), and bulk CSV upload with row validation and preview before import.

  • [Frontend] — ENHANCEMENT: Add AI Oracle Dashboard at /oracle/creator-events #886 [Frontend] — Implemented /oracle/creator-events AI Oracle dashboard with stats cards, tabbed interface (Pending / Batch Submit / Recent Results), per-match result submission modal (outcome selector, confidence score, data source, tx hash link), batch CSV submission, and oracle wallet access guard.

Files changed

Backend

  • backend/src/contract/contract.service.spec.ts — new comprehensive test suite
  • backend/src/analytics/analytics.service.spec.ts — expanded coverage
  • backend/src/notifications/notifications.service.spec.ts — expanded coverage

Frontend

  • frontend/src/app/(authenticated)/creator-events/create/page.tsx
  • frontend/src/component/creator-events/CreateEventForm.tsx
  • frontend/src/app/(authenticated)/creator-events/[id]/matches/page.tsx
  • frontend/src/component/creator-events/AddMatchForm.tsx
  • frontend/src/component/creator-events/BulkMatchUpload.tsx
  • frontend/src/app/(oracle)/creator-events/page.tsx
  • frontend/src/app/(oracle)/layout.tsx
  • frontend/src/component/oracle/PendingMatchesList.tsx
  • frontend/src/component/oracle/SubmitResultForm.tsx
  • frontend/src/component/oracle/BatchResultSubmission.tsx
  • frontend/src/component/oracle/OracleGuard.tsx
  • frontend/src/component/oracle/OracleShell.tsx

Test plan

  • Run cd backend && npm test — all contract, analytics, and notifications service specs pass
  • Navigate to /creator-events/create — 3-step form renders, draft saves/restores, step 2 shows fee, step 3 shows invite code with share buttons
  • Navigate to /creator-events/[id]/matches as creator — match list, add form, and CSV bulk upload work; non-creators are redirected
  • Navigate to /oracle/creator-events as oracle wallet — stats, pending matches, submit result modal, batch CSV, and recent results all work; non-oracle wallets are redirected

Closes #763
Closes #879
Closes #881
Closes #886

…rena1X#879, Arena1X#881, Arena1X#886)

## Arena1X#763 — Backend unit tests for services

- Add comprehensive unit tests for ContractService covering all view
  function calls (getEvent, getMatch, getEventMatches, getUserPredictions,
  getEventParticipants, getEventWinners, getConfig, getCreationFee,
  isVerified, getEventStatistics, getPredictionDistribution), retry
  logic with 3-attempt exhaustion, and RPC simulation paths including
  error, missing retval, and transient-retry-then-succeed scenarios
- Expand AnalyticsService tests to cover getDashboardKPIs aggregation,
  streak calculation, getMarketHistory date filters, logActivity,
  getMarketAnalytics outcome distribution, getCategoryAnalytics
  sorting/trending logic, and getUserTrends with days clamping
- Expand NotificationsService tests to cover create, findAllForUser
  (read filter, type filter, pagination skip/take, limit cap), markAsRead,
  markAllAsRead, remove (including NotFoundException), markMultipleAsRead,
  and getUnreadCount
- All tests use mocks for external dependencies (Stellar SDK, TypeORM
  repositories); no real network or database calls

## Arena1X#879 — Create Creator Event Page at /creator-events/create

- Add `frontend/src/app/(authenticated)/creator-events/create/page.tsx`
  with breadcrumb navigation and page header
- Add `frontend/src/component/creator-events/CreateEventForm.tsx`
  implementing a 3-step multi-step form:
  - Step 1: event title (max 200 chars), description (max 1000 chars,
    markdown supported), max participants (2–1000) with field validation
  - Step 2: creation fee display (XLM), event summary, wallet address
    check, "Create Event & Pay Fee" button with transaction signing state
  - Step 3: success view with generated 8-character invite code, copy
    button, Twitter/Telegram/copy-link share buttons, "Add Matches"
    redirect to /creator-events/[id]/matches
- Draft persistence via localStorage with "Save as Draft" button

## Arena1X#881 — Match Management Page at /creator-events/[id]/matches

- Add `frontend/src/app/(authenticated)/creator-events/[id]/matches/page.tsx`
  with creator-only access guard (redirects non-creators to event detail),
  breadcrumb navigation, existing matches list with status badges
  (Upcoming/Started/Resolved), edit button for upcoming matches, delete
  button for matches without predictions, and 100-match cap warning
- Add `frontend/src/component/creator-events/AddMatchForm.tsx` with Team A /
  Team B name inputs (max 100 chars), datetime-local picker requiring a
  future time, duplicate match detection, and full client-side validation
- Add `frontend/src/component/creator-events/BulkMatchUpload.tsx` with CSV
  file upload, row-by-row parsing and validation (empty teams, same-team
  names, invalid/past ISO 8601 dates), preview table with valid/error
  counts, remaining-slot enforcement, and "Import All" submission

## Arena1X#886 — AI Oracle Dashboard at /oracle/creator-events

- Add `frontend/src/app/(oracle)/creator-events/page.tsx` with stats cards
  (pending matches, total submitted, submitted today, avg delay), tabbed
  interface (Pending / Batch Submit / Recent), batch-select mode, and
  recent results list with Stellar Explorer tx hash links
- Add `frontend/src/component/oracle/PendingMatchesList.tsx` with event
  filter dropdown, asc/desc sort by match time, batch-selection checkboxes,
  and per-match "Submit Result" button
- Add `frontend/src/component/oracle/SubmitResultForm.tsx` modal with
  outcome selector (Team A Won / Team B Won / Draw), optional confidence
  score and data source inputs, transaction signing state, and post-submit
  success view with tx hash link
- Add `frontend/src/component/oracle/BatchResultSubmission.tsx` with CSV
  upload (Match ID, Outcome columns), validation preview, and "Submit All
  Results" button
- Add `frontend/src/component/oracle/OracleGuard.tsx` and OracleShell for
  agent-address access control with redirect for non-oracle wallets
- Add `frontend/src/app/(oracle)/layout.tsx` wrapping oracle pages in
  OracleGuard + OracleShell

Closes Arena1X#763
Closes Arena1X#879
Closes Arena1X#881
Closes Arena1X#886
@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

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

Project Deployment Actions Updated (UTC)
insight-arena-4rll Error Error May 30, 2026 3:38pm

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@djcdz4 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

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

Labels

None yet

Projects

None yet

1 participant