mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-07 08:12:54 +00:00
refactor: share live transport scenario helpers
This commit is contained in:
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user