Skip to content

Commit 0369c8e

Browse files
committed
test(daemon): bracket the recorded baseline instant with the reads around it (#3471)
The bound was "within the last second" of assertion time, so a CI pause between the mark and the comparison could fail the test while the marker itself stayed correct. Reading the clock before the call and again in the assertion keeps the claim the test actually makes — the stamp is the mutation END, not the action's start — and removes the slack the bound needed.
1 parent a1aed7d commit 0369c8e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎src/daemon/__tests__/moving-target-baseline.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,17 @@ function markPress(session: SessionState, preActionTree: SurfaceScopedNodes | un
4545
test('a mutation that resolved a target records its tree at the instant it finished', () => {
4646
const session = makeSession('android');
4747
const preAction = appTree();
48+
const before = Date.now();
4849

4950
markPress(session, { nodes: preAction.nodes });
5051

5152
const baseline = movingTargetBaseline(session);
5253
assert.ok(baseline);
5354
assert.equal(baseline.tree.nodes, preAction.nodes);
55+
// Bracketed by the reads around the call rather than by a fixed slack: a CI pause between the mark
56+
// and the assertion would blow a "within one second" bound while the recorded instant stayed right.
5457
assert.ok(
55-
baseline.finishedAt >= Date.now() - 1_000 && baseline.finishedAt <= Date.now(),
58+
baseline.finishedAt >= before && baseline.finishedAt <= Date.now(),
5659
'the clock is the mutation END: the gate waits out what is LEFT of the window',
5760
);
5861
});

0 commit comments

Comments
 (0)