-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathserver-session-status-canonical-fallback.test.ts
More file actions
34 lines (29 loc) · 1.17 KB
/
Copy pathserver-session-status-canonical-fallback.test.ts
File metadata and controls
34 lines (29 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { describe, expect, test } from "vite-plus/test";
import type { HarnessEvent } from "@/agents/backend";
import { LiveSessionEventBus } from "@opengui/runtime";
import { BackendEventBus } from "../server/services/event-bus.ts";
import { publishLiveSessionHarnessEvent } from "../server/live-session-event-publish.ts";
const directory = "/repo";
const harnessId = "pi" as const;
const sessionId = "pi:s1";
describe("session.status canonical fallback policy", () => {
test("retry status produces no live events and should still reach canonical bus", () => {
const events = new BackendEventBus();
const bus = new LiveSessionEventBus();
const published: string[] = [];
events.subscribe((envelope) => published.push(envelope.type));
const retry: HarnessEvent = {
type: "session.status",
sessionID: sessionId,
status: { type: "retry" },
};
const live = publishLiveSessionHarnessEvent(
{ events },
{ directory, harnessId, event: retry },
bus,
);
expect(live).toHaveLength(0);
events.publish("session.status", retry, { harnessId, sessionId, directory });
expect(published).toEqual(["session.status"]);
});
});