refactor: share live transport scenario helpers

This commit is contained in:
Vincent Koc
2026-05-29 02:24:14 +02:00
parent 7bf100b028
commit ca41fa293f
4 changed files with 223 additions and 295 deletions

View File

@@ -95,6 +95,58 @@ describe("plugin-sdk qa-runtime", () => {
expect(report).toContain("## Timeline");
});
it("keeps shared live transport scenario coverage helpers ordered and strict", async () => {
const module = await import("./qa-runtime.js");
expect(module.LIVE_TRANSPORT_BASELINE_STANDARD_SCENARIO_IDS).toEqual([
"canary",
"mention-gating",
"allowlist-block",
"top-level-reply-shape",
"restart-resume",
]);
const definitions = [
{ id: "alpha", timeoutMs: 1_000, title: "alpha" },
{ id: "beta", timeoutMs: 1_000, title: "beta" },
] as const;
expect(
module.selectLiveTransportScenarios({
ids: ["beta"],
laneLabel: "Demo",
scenarios: definitions,
}),
).toEqual([definitions[1]]);
expect(() =>
module.selectLiveTransportScenarios({
ids: ["missing"],
laneLabel: "Demo",
scenarios: definitions,
}),
).toThrow("unknown Demo QA scenario id(s): missing");
const covered = module.collectLiveTransportStandardScenarioCoverage({
alwaysOnStandardScenarioIds: ["canary"],
scenarios: [
{ id: "scenario-1", standardId: "mention-gating", timeoutMs: 1_000, title: "mention" },
{
id: "scenario-2",
standardId: "mention-gating",
timeoutMs: 1_000,
title: "mention again",
},
{ id: "scenario-3", standardId: "restart-resume", timeoutMs: 1_000, title: "restart" },
],
});
expect(covered).toEqual(["canary", "mention-gating", "restart-resume"]);
expect(
module.findMissingLiveTransportStandardScenarios({
coveredStandardScenarioIds: covered,
expectedStandardScenarioIds: module.LIVE_TRANSPORT_BASELINE_STANDARD_SCENARIO_IDS,
}),
).toEqual(["allowlist-block", "top-level-reply-shape"]);
});
it("builds shared live-lane artifact errors", async () => {
const module = await import("./qa-runtime.js");