Skip to content

Commit a25e942

Browse files
test(signals): feedback() interaction rows looked up by name, not rank
The table ranks by measured time (heldMs + selfMs); ten trivial re-runs against one is not a stable order on a cold CI runner (the first interaction absorbs JIT warm-up and won on GitHub's Linux box). Assert the counts per interaction; the ranking is the table's business. Co-authored-by: Cursor <[email protected]>
1 parent 6c8c956 commit a25e942

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎packages/signals/tests/attribution-feedback.test.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,18 @@ describe("feedback()", () => {
249249
const { sources, interactions } = DEV!.attribution.feedback();
250250
expect(sources).toEqual([]);
251251
expect(interactions).toHaveLength(2);
252-
expect(interactions[0]).toMatchObject({
253-
interaction: "click on button#b",
252+
// Rows are ranked by measured time (heldMs + selfMs); ten trivial runs
253+
// versus one is not a stable ordering on a cold CI runner, so look the
254+
// rows up by name and assert the counts.
255+
const byName = Object.fromEntries(interactions.map(row => [row.interaction, row]));
256+
expect(byName["click on button#b"]).toMatchObject({
254257
dispatches: 2,
255258
runs: 10,
256259
holds: 0,
257260
heldMs: 0,
258261
silentMs: 0
259262
});
260-
expect(interactions[1]).toMatchObject({
261-
interaction: "input on input#a",
263+
expect(byName["input on input#a"]).toMatchObject({
262264
dispatches: 1,
263265
runs: 1
264266
});

0 commit comments

Comments
 (0)