mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
address review: clear marks before test, assert exactly 2
This commit is contained in:
@@ -72,6 +72,9 @@
|
|||||||
|
|
||||||
<script id="buffered_option">
|
<script id="buffered_option">
|
||||||
{
|
{
|
||||||
|
// Clear marks from previous tests so we get a precise count
|
||||||
|
performance.clearMarks();
|
||||||
|
|
||||||
// Create marks BEFORE the observer
|
// Create marks BEFORE the observer
|
||||||
performance.mark("early1", { startTime: 1.0 });
|
performance.mark("early1", { startTime: 1.0 });
|
||||||
performance.mark("early2", { startTime: 2.0 });
|
performance.mark("early2", { startTime: 2.0 });
|
||||||
@@ -81,17 +84,14 @@
|
|||||||
receivedEntries = list.getEntries();
|
receivedEntries = list.getEntries();
|
||||||
});
|
});
|
||||||
|
|
||||||
// With buffered: true, existing marks should be delivered immediately
|
// With buffered: true, existing marks should be delivered
|
||||||
observer.observe({ type: "mark", buffered: true });
|
observer.observe({ type: "mark", buffered: true });
|
||||||
|
|
||||||
testing.eventually(() => {
|
testing.eventually(() => {
|
||||||
testing.expectEqual(true, receivedEntries !== null);
|
testing.expectEqual(true, receivedEntries !== null);
|
||||||
// Should have received at least the 2 early marks
|
testing.expectEqual(2, receivedEntries.length);
|
||||||
testing.expectEqual(true, receivedEntries.length >= 2);
|
testing.expectEqual("early1", receivedEntries[0].name);
|
||||||
|
testing.expectEqual("early2", receivedEntries[1].name);
|
||||||
const names = receivedEntries.map(e => e.name);
|
|
||||||
testing.expectEqual(true, names.indexOf("early1") >= 0);
|
|
||||||
testing.expectEqual(true, names.indexOf("early2") >= 0);
|
|
||||||
|
|
||||||
observer.disconnect();
|
observer.disconnect();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user