Add frontend UX unit tests for #331 visual features (#339) #514

Merged
PlasticDigits merged 1 commit from issue-339-frontend-ux-unit-tests into main 2026-06-19 11:03:15 +00:00
PlasticDigits commented 2026-06-19 10:59:40 +00:00 (Migrated from gitlab.com)

Summary

Adds consolidated Vitest regression coverage for gap-analysis #331 visual children (#339):

  • Sad paths: indexer-off / no WYWA activity gate, disconnected wallet, empty level history, empty toast stack, malformed session-summary payloads, reduced-motion confetti skip (existing).
  • Wiring asserts: ArenaSimplePage (#334/#335/#337), TimeArenaPage + visual hooks (arenaVisualUxHooks.test.ts).
  • Docs: INV-FRONTEND-339-UX-UNIT-TESTS invariant + play-surface row in frontend-content-audit.md.

Extracted hasWywaSummaryActivity helper so WYWA activity detection is unit-testable without duplicating hook logic.

Acceptance checklist

Criterion Command / step Result
Each closed #331 visual child has ≥1 focused Vitest file or describe block See child→test map below PASS
Happy + sad path cases documented in test names Review *test.ts(x) files tagged #334–#338 PASS
cd frontend && npm run typecheck && npm run lint && npm test cd frontend && npm run typecheck && npm run lint && npm test PASS
No snapshot-only tests without behavioral asserts All new/extended tests use expect(...) on render/copy/DOM/testids PASS

Child issue → test file(s)

Child Tests Result
#334 Next-level lock policy arenaProgression.test.ts, ArenaTimerPodiumCarousel.test.tsx, ArenaSimplePodiumSection.test.tsx, ArenaSimplePage.test.tsx PASS
#335 Level-up confetti popover arenaLevelUpCelebration.test.ts, LevelUpCelebrationPopover.test.tsx, arenaVisualUxHooks.test.ts, ArenaSimplePage.test.tsx PASS
#336 Wallet level history WalletProfileModalSections.test.tsx (+ empty-history sad path) PASS
#337 Post-buy effect toasts arenaBuyEffectToastLines.test.ts, ArenaEffectToastStack.test.tsx, mobileBuyEffectToastLayout.test.ts, arenaVisualUxHooks.test.ts PASS
#338 While You Were Away modal WhileYouWereAwayModal.test.tsx, whileYouWereAwayActivity.test.ts, arenaSessionClose.test.ts, TimeArenaPage.test.tsx, indexerApi.test.ts PASS

Verification for third parties

  1. git fetch && git checkout issue-339-frontend-ux-unit-tests
  2. cd frontend && npm run typecheck && npm run lint && npm test — expect 141 files / 743 tests PASS.
  3. Spot-check sad paths:
    • npx vitest run src/lib/whileYouWereAwayActivity.test.ts
    • npx vitest run src/components/WhileYouWereAwayModal.test.tsx
    • npx vitest run src/components/WalletProfileModalSections.test.tsx -t "empty"
  4. Confirm docs: grep INV-FRONTEND-339 docs/testing/invariants-and-business-logic.md

Related: #339 (leave open for merge close).

## Summary Adds consolidated Vitest regression coverage for gap-analysis [#331](https://gitlab.com/PlasticDigits/yieldomega/-/issues/331) visual children ([#339](https://gitlab.com/PlasticDigits/yieldomega/-/issues/339)): - **Sad paths:** indexer-off / no WYWA activity gate, disconnected wallet, empty level history, empty toast stack, malformed session-summary payloads, reduced-motion confetti skip (existing). - **Wiring asserts:** `ArenaSimplePage` (#334/#335/#337), `TimeArenaPage` + visual hooks (`arenaVisualUxHooks.test.ts`). - **Docs:** `INV-FRONTEND-339-UX-UNIT-TESTS` invariant + play-surface row in `frontend-content-audit.md`. Extracted `hasWywaSummaryActivity` helper so WYWA activity detection is unit-testable without duplicating hook logic. ## Acceptance checklist | Criterion | Command / step | Result | |-----------|----------------|--------| | Each closed #331 visual child has ≥1 focused Vitest file or describe block | See child→test map below | PASS | | Happy + sad path cases documented in test names | Review `*test.ts(x)` files tagged #334–#338 | PASS | | `cd frontend && npm run typecheck && npm run lint && npm test` | `cd frontend && npm run typecheck && npm run lint && npm test` | PASS | | No snapshot-only tests without behavioral asserts | All new/extended tests use `expect(...)` on render/copy/DOM/testids | PASS | ### Child issue → test file(s) | Child | Tests | Result | |-------|-------|--------| | [#334](https://gitlab.com/PlasticDigits/yieldomega/-/issues/334) Next-level lock policy | `arenaProgression.test.ts`, `ArenaTimerPodiumCarousel.test.tsx`, `ArenaSimplePodiumSection.test.tsx`, `ArenaSimplePage.test.tsx` | PASS | | [#335](https://gitlab.com/PlasticDigits/yieldomega/-/issues/335) Level-up confetti popover | `arenaLevelUpCelebration.test.ts`, `LevelUpCelebrationPopover.test.tsx`, `arenaVisualUxHooks.test.ts`, `ArenaSimplePage.test.tsx` | PASS | | [#336](https://gitlab.com/PlasticDigits/yieldomega/-/issues/336) Wallet level history | `WalletProfileModalSections.test.tsx` (+ empty-history sad path) | PASS | | [#337](https://gitlab.com/PlasticDigits/yieldomega/-/issues/337) Post-buy effect toasts | `arenaBuyEffectToastLines.test.ts`, `ArenaEffectToastStack.test.tsx`, `mobileBuyEffectToastLayout.test.ts`, `arenaVisualUxHooks.test.ts` | PASS | | [#338](https://gitlab.com/PlasticDigits/yieldomega/-/issues/338) While You Were Away modal | `WhileYouWereAwayModal.test.tsx`, `whileYouWereAwayActivity.test.ts`, `arenaSessionClose.test.ts`, `TimeArenaPage.test.tsx`, `indexerApi.test.ts` | PASS | ## Verification for third parties 1. `git fetch && git checkout issue-339-frontend-ux-unit-tests` 2. `cd frontend && npm run typecheck && npm run lint && npm test` — expect **141** files / **743** tests PASS. 3. Spot-check sad paths: - `npx vitest run src/lib/whileYouWereAwayActivity.test.ts` - `npx vitest run src/components/WhileYouWereAwayModal.test.tsx` - `npx vitest run src/components/WalletProfileModalSections.test.tsx -t "empty"` 4. Confirm docs: `grep INV-FRONTEND-339 docs/testing/invariants-and-business-logic.md` Related: [#339](https://gitlab.com/PlasticDigits/yieldomega/-/issues/339) (leave open for merge close).
PlasticDigits commented 2026-06-19 11:02:24 +00:00 (Migrated from gitlab.com)

Security review — MR !514

Commit reviewed: 916025477a294aaf3cd285404c2c775c9fb7427d
Scope: Vitest regression coverage for #331 visual UX (#334–#338); docs/invariant updates (INV-FRONTEND-339-UX-UNIT-TESTS); production refactor extracting hasWywaSummaryActivity from useWhileYouWereAway (behavior-preserving).

Method

  • Diff and production paths traced for attacker-controlled input → sink (XSS, injection, authz, SSRF, secret leakage, EVM/on-chain surfaces).
  • Prior security-review threads on this MR: none found.

Production code touched

File Change
frontend/src/lib/whileYouWereAwayActivity.ts New helper — same Number.isFinite + > 0 checks and podium_epochs_ended.length gate as prior inline logic
frontend/src/hooks/useWhileYouWereAway.ts Calls helper; no new network surface, auth, or rendering

All other changes are Vitest tests (static markup, sad-path asserts, source-string wiring checks) and documentation.

Findings reviewed (not reported — below medium)

  • Indexer JSON → WYWA modal XSS: WhileYouWereAwayModal renders summary fields as React text children; addresses go through AddressInline / normalizeAddr. Unchanged by this MR; no new dangerouslySetInnerHTML or HTML sinks introduced.
  • Malformed session-summary numerics: hasWywaSummaryActivity treats non-finite Number() results as inactive; sad-path test confirms modal is skipped. No auth or funds impact.
  • Test readFileSync on local sources: Dev/test-only (arenaVisualUxHooks.test.ts, wiring tests); not shipped to browsers.
  • EVM / contracts / indexer API / dependencies: No changes in this diff.

Outcome: FINDINGS: 0 (no medium, high, or critical issues on this diff)

Inline threads: none (no findings to anchor)

Security review: no medium+ findings on this diff.

## Security review — MR !514 **Commit reviewed:** `916025477a294aaf3cd285404c2c775c9fb7427d` **Scope:** Vitest regression coverage for #331 visual UX (#334–#338); docs/invariant updates (`INV-FRONTEND-339-UX-UNIT-TESTS`); production refactor extracting `hasWywaSummaryActivity` from `useWhileYouWereAway` (behavior-preserving). ### Method - Diff and production paths traced for attacker-controlled input → sink (XSS, injection, authz, SSRF, secret leakage, EVM/on-chain surfaces). - Prior security-review threads on this MR: none found. ### Production code touched | File | Change | |------|--------| | `frontend/src/lib/whileYouWereAwayActivity.ts` | New helper — same `Number.isFinite` + `> 0` checks and `podium_epochs_ended.length` gate as prior inline logic | | `frontend/src/hooks/useWhileYouWereAway.ts` | Calls helper; no new network surface, auth, or rendering | All other changes are Vitest tests (static markup, sad-path asserts, source-string wiring checks) and documentation. ### Findings reviewed (not reported — below medium) - **Indexer JSON → WYWA modal XSS:** `WhileYouWereAwayModal` renders summary fields as React text children; addresses go through `AddressInline` / `normalizeAddr`. Unchanged by this MR; no new `dangerouslySetInnerHTML` or HTML sinks introduced. - **Malformed session-summary numerics:** `hasWywaSummaryActivity` treats non-finite `Number()` results as inactive; sad-path test confirms modal is skipped. No auth or funds impact. - **Test `readFileSync` on local sources:** Dev/test-only (`arenaVisualUxHooks.test.ts`, wiring tests); not shipped to browsers. - **EVM / contracts / indexer API / dependencies:** No changes in this diff. **Outcome: FINDINGS: 0** (no medium, high, or critical issues on this diff) **Inline threads:** none (no findings to anchor) Security review: no medium+ findings on this diff.
PlasticDigits (Migrated from gitlab.com) merged commit bbf6bbb3f7 into main 2026-06-19 11:03:15 +00:00
PlasticDigits commented 2026-06-19 11:03:17 +00:00 (Migrated from gitlab.com)

mentioned in commit bbf6bbb3f7

mentioned in commit bbf6bbb3f7a14a5750d8247263a0b9ef2e9796bd
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
code/yieldomega!514
No description provided.