Skip to content

Commit df22284

Browse files
committed
test: tighten control ui buffer assertions
1 parent 9fcb583 commit df22284

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

ui/src/ui/control-ui-performance.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,13 @@ describe("recordControlUiPerformanceEvent", () => {
7070
}
7171

7272
expect(host.eventLogBuffer).toHaveLength(250);
73-
expect(host.eventLogBuffer[0]?.payload).toEqual({ i: 259 });
74-
expect(host.eventLogBuffer.at(-1)?.payload).toEqual({ i: 10 });
73+
const [newestEvent] = host.eventLogBuffer;
74+
const oldestEvent = host.eventLogBuffer.at(-1);
75+
if (!newestEvent || !oldestEvent) {
76+
throw new Error("Expected bounded performance event buffer entries");
77+
}
78+
expect(newestEvent.payload).toEqual({ i: 259 });
79+
expect(oldestEvent.payload).toEqual({ i: 10 });
7580
});
7681
});
7782

0 commit comments

Comments
 (0)