
 RUN  v5.1.0 /home/athapa/patriothacks-wt/fix-miniapp-gaps-and-demo-video-wave1

 ✓ src/lib/fairdraw.test.ts > fairdraw commit/reveal/verify property test > verifies reveal() against the earlier commit() hash for 100 random (seed, salt) pairs 33ms
 ✓ src/lib/fairdraw.test.ts > fairdraw commit/reveal/verify property test > fails verify() visibly for a tampered reveal with the wrong seed 0ms
 ✓ src/lib/fairdraw.test.ts > fairdraw commit/reveal/verify property test > fails verify() visibly for a tampered reveal with the wrong salt 0ms
 ✓ src/lib/fairdraw.test.ts > fairdraw commit encoding - closes the seed/salt separator collision > commit('7', 'x:9') and commit('7:x', '9') no longer collide (old `:`-join bug) 1ms
 ✓ src/lib/fairdraw.test.ts > fairdraw commit encoding - closes the seed/salt separator collision > both halves of the old collision still verify correctly against their own commit 1ms
 ✓ src/lib/fairdraw.test.ts > fairdraw QA - happy path: full commit/reveal/verify cycle for a 5-way draw > recomputes the published commit hash and reproduces the draw outcome 1ms
 ✓ src/lib/fairdraw.test.ts > fairdraw QA - failure path: reveal a seed that does not match the earlier commit > returns false from verify() instead of throwing or silently accepting 0ms
 ✓ src/lib/fairdraw.test.ts > fairdraw.commit / fairdraw.reveal payload type guards > accepts a well-formed fairdraw.commit payload 1ms
 ✓ src/lib/fairdraw.test.ts > fairdraw.commit / fairdraw.reveal payload type guards > rejects a fairdraw.commit payload with a missing drawId 0ms
 ✓ src/lib/fairdraw.test.ts > fairdraw.commit / fairdraw.reveal payload type guards > rejects a fairdraw.commit payload with a garbage (non-hex, wrong-length) commitHash 0ms
 ✓ src/lib/fairdraw.test.ts > fairdraw.commit / fairdraw.reveal payload type guards > rejects non-object and null payloads without throwing 0ms
 ✓ src/lib/fairdraw.test.ts > fairdraw.commit / fairdraw.reveal payload type guards > accepts a well-formed fairdraw.reveal payload and rejects one with an empty seed 0ms
 ✓ src/lib/fairdraw.test.ts > validateReveal - append-to-log commit-before-reveal fix (plan todo 8) > happy path: a genuinely published commit followed by a later reveal validates true and reproduces the correct winner 1ms
 ✓ src/lib/fairdraw.test.ts > validateReveal - append-to-log commit-before-reveal fix (plan todo 8) > rejects a reveal with no prior commit entry for the same drawId 0ms
 ✓ src/lib/fairdraw.test.ts > validateReveal - append-to-log commit-before-reveal fix (plan todo 8) > rejects a second reveal for an already-revealed drawId (one-reveal-per-draw) 0ms
 ✓ src/lib/fairdraw.test.ts > validateReveal - append-to-log commit-before-reveal fix (plan todo 8) > rejects a reveal whose lamportTs is not strictly after its commit's lamportTs 0ms
 ✓ src/lib/fairdraw.test.ts > validateReveal - append-to-log commit-before-reveal fix (plan todo 8) > rejects when the reveal does not verify against the published commit (tampered seed) 0ms
 ✓ src/lib/fairdraw.test.ts > validateReveal - append-to-log commit-before-reveal fix (plan todo 8) > malformed_input: a garbage drawId never throws and simply returns false 0ms
 ✓ src/lib/fairdraw.test.ts > validateReveal - append-to-log commit-before-reveal fix (plan todo 8) > malformed_input: a log full of commit/reveal-shaped entries with missing/garbage fields never throws and is ignored 0ms
 ✓ src/lib/fairdraw.test.ts > validateReveal - append-to-log commit-before-reveal fix (plan todo 8) > cancel_resume / stale_state: validates correctly against a cold-replayed log snapshot (readAll()-shaped array), not just a live session 0ms
 ✓ src/lib/fairdraw.test.ts > validateReveal - append-to-log commit-before-reveal fix (plan todo 8) > canonical commit: when multiple commits exist for the same drawId, the earliest (lowest lamportTs) one is used 0ms
 ✓ src/miniapps/fairdraw/RevealDraw.test.tsx > RevealDraw (plan todo 21, QA happy path) > displays the published commit hash before reveal, then renders a verified badge only after the real verify() call returns true for that exact draw 115ms
 ✓ src/miniapps/fairdraw/RevealDraw.test.tsx > RevealDraw (plan todo 21, QA failure path) > shows a visible invalid state rather than a false verified badge when the reveal broadcast is tampered with (mismatched seed) 32ms
 ✓ src/miniapps/fairdraw/RevealDraw.test.tsx > RevealDraw (plan todo 21, QA failure path) > never shows a verified badge for a commit hash that was never actually recomputed 1ms
 ✓ src/miniapps/fairdraw/RevealDraw.test.tsx > RevealDraw wallet wiring (plan todo 13, QA happy/failure path) > issues a real wallet.issue credit to the winner's account only - never to the loser's 33ms
 ✓ src/miniapps/fairdraw/RevealDraw.test.tsx > RevealDraw wallet wiring (plan todo 13, QA happy/failure path) > credits the mapped participantAccounts entry, not the display name, when provided (production's real-identity wiring) 27ms
 ✓ src/miniapps/fairdraw/RevealDraw.test.tsx > RevealDraw wallet wiring (plan todo 13, QA happy/failure path) > genuinely moves the winner's real ledger balance via the real append()/eventlog path, leaving the loser's balance at 0 32ms
 ✓ src/miniapps/fairdraw/RevealDraw.test.tsx > RevealDraw wallet wiring (plan todo 13, QA happy/failure path) > never issues a wallet credit when the reveal is tampered with (no winner is ever determined) 27ms
 ✓ src/miniapps/fairdraw/RevealDraw.test.tsx > RevealDraw append-to-log commit requirement (plan todo 8, require a published signed commit before reveal) > reaches the committed phase (Reveal enabled) only after append() resolves AND a fresh readAll() independently confirms the fairdraw.commit entry exists in the log 14ms
 ✓ src/miniapps/fairdraw/RevealDraw.test.tsx > RevealDraw append-to-log commit requirement (plan todo 8, require a published signed commit before reveal) > cancel_resume: the commit survives an independent readAll() taken between commit and reveal (simulating a reload/another replica reading the log mid-draw), and the reveal afterwards still completes and validates against it 28ms
 ✓ src/miniapps/fairdraw/RevealDraw.test.tsx > RevealDraw append-to-log commit requirement (plan todo 8, require a published signed commit before reveal) > appends exactly one fairdraw.commit and one fairdraw.reveal per completed draw, both carrying the same drawId 28ms

 Test Files  2 passed (2)
      Tests  31 passed (31)
   Start at  14:35:00
   Duration  770ms (tests 49%, environment 26%, import 14%, setup 5%, transform 5%, worker 1%)

