test: guard ui tooling assertions

This commit is contained in:
Peter Steinberger
2026-05-11 20:24:29 +01:00
parent b6027cb40e
commit 3c9fbf7071
2 changed files with 14 additions and 9 deletions

View File

@@ -818,10 +818,13 @@ describe("scripts/lib/docker-e2e-plan", () => {
), ),
); );
expect(plan.lanes).toHaveLength(BUNDLED_PLUGIN_INSTALL_UNINSTALL_SHARDS); expect(plan.lanes).toHaveLength(BUNDLED_PLUGIN_INSTALL_UNINSTALL_SHARDS);
expect(plan.lanes.at(0)).toBeDefined(); const firstLane = plan.lanes[0];
expect(plan.lanes.at(23)).toBeDefined(); const lastLane = plan.lanes[23];
expect(summarizeLane(plan.lanes[0])).toEqual(bundledPluginSweepLane(0)); if (!firstLane || !lastLane) {
expect(summarizeLane(plan.lanes[23])).toEqual(bundledPluginSweepLane(23)); throw new Error("Expected bundled plugin sweep boundary lanes");
}
expect(summarizeLane(firstLane)).toEqual(bundledPluginSweepLane(0));
expect(summarizeLane(lastLane)).toEqual(bundledPluginSweepLane(23));
expect(plan.needs).toEqual({ expect(plan.needs).toEqual({
bareImage: false, bareImage: false,
e2eImage: true, e2eImage: true,

View File

@@ -177,12 +177,14 @@ function expectBufferedPerformanceEvent(
return candidate.payload?.[key] === expected; return candidate.payload?.[key] === expected;
}); });
}); });
expect(entry).toBeDefined(); if (!entry) {
for (const [key, expected] of Object.entries(expectedPayload)) { throw new Error(`Expected performance event ${event}`);
expect(entry?.payload?.[key]).toBe(expected);
} }
expect(entry?.payload?.durationMs).toBeTypeOf("number"); for (const [key, expected] of Object.entries(expectedPayload)) {
return entry?.payload; expect(entry.payload?.[key]).toBe(expected);
}
expect(entry.payload?.durationMs).toBeTypeOf("number");
return entry.payload;
} }
describe("refreshActiveTab", () => { describe("refreshActiveTab", () => {