tests: each demo claim stage hold starts after the previous one ended
Review P2: assertHeld checked each recorded hold's length on its own, so a page that lost its reset of since (holds counted from stage 1's start) passed while stages 2 and 3 flashed by. It now also requires each hold to start at or after the previous stage's hold ended. With that reset removed, the old assertion passed and the new one fails.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+7
−1
internal/console/testdata/demo_claim_browser.mjs+7 −1
diff --git a/internal/console/testdata/demo_claim_browser.mjs b/internal/console/testdata/demo_claim_browser.mjs| index c538e6067..d1d8ed238 100644 |
| --- a/internal/console/testdata/demo_claim_browser.mjs |
| +++ b/internal/console/testdata/demo_claim_browser.mjs |
| @@ -20,17 +20,23 @@ const minimum = 650; |
| const heldAtLeast = minimum - 1 - 0.2; |
| // assertHeld checks the page showed stages 1 to 4 in order and held each of |
| -// the first three for the minimum by its own clock. |
| +// the first three for the minimum by its own clock. Each hold must start in |
| +// its own stage, at or after the previous stage ended: a hold counted from |
| +// an earlier stage's start (a reset of since lost) would pass on duration |
| +// alone while the later stages flashed by. |
| async function assertHeld() { |
| const stages = await evaluate('window.claimStages'); |
| const holds = await evaluate('window.claimHolds'); |
| const report = JSON.stringify({stages, holds}); |
| + let previous; |
| for (const stage of [1,2,3]) { |
| const at = stages.indexOf(stage); |
| assert(at >= 0 && stages[at+1] === stage+1, report); |
| const hold = holds.find(row => row.stage === stage); |
| assert(hold && Number.isFinite(hold.held), report); |
| assert(hold.held >= heldAtLeast, report); |
| + if (previous) assert(hold.from >= previous.to, report); |
| + previous = hold; |
| } |
| } |