test(canvas/lib): add hydrate.test.ts — 7 cases for exponential-backoff hydration #703

Merged
app-fe merged 1 commits from test/701-canvas-hydrate-coverage into staging 2026-05-12 17:16:40 +00:00

1 Commits

Author SHA1 Message Date
6200a11048 test(canvas/lib): add hydrate.test.ts — 7 cases for exponential-backoff canvas hydration
All checks were successful
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 10s
sop-tier-check / tier-check (pull_request) Successful in 13s
audit-force-merge / audit (pull_request) Successful in 8s
Tests canvas/src/lib/hydrate.ts: hydrateCanvas() with exponential backoff retry.

Cases:
1. Success on first attempt → { error: null }
2. Viewport fetch failure is non-fatal → store still hydrates
3. Success after 1 retry → onRetrying(1) called once, result { error: null }
4. onRetrying called correctly on each failed attempt
5. All attempts fail → error message after MAX_RETRIES
6. onRetrying called MAX_RETRIES-1 times before final exhausted attempt
7. Total elapsed time ≈ sum of exponential delays (1s + 2s = 3s)

Each attempt makes 2 parallel api.get calls (workspaces + viewport); mocks
set up per parallel-call to avoid Promise.all consuming wrong mock slots.

Issue: #701

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 09:46:29 +00:00