mirror of
https://github.com/Tencent/BrowserSkill.git
synced 2026-09-10 13:01:23 +08:00
Initial public release
This commit is contained in:
commit
f1036a860c
289 files changed
+54589
No files matched your search
@@ -0,0 +1,47 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import {
|
||||
OVERLAY_AGENT_OVERLAY_RESET,
|
||||
OVERLAY_MSG_INTERRUPT,
|
||||
type OverlayInterruptRequest,
|
||||
type OverlayInterruptResponse,
|
||||
isOverlayAgentOverlayResetMessage,
|
||||
} from "@/lib/overlay-bridge";
|
||||
|
||||
describe("OVERLAY_MSG_INTERRUPT", () => {
|
||||
it("constant matches the wire string content scripts will send", () => {
|
||||
expect(OVERLAY_MSG_INTERRUPT).toBe("overlay.interrupt");
|
||||
});
|
||||
|
||||
it("OverlayInterruptRequest type carries kind + sessionId", () => {
|
||||
const req: OverlayInterruptRequest = {
|
||||
kind: OVERLAY_MSG_INTERRUPT,
|
||||
sessionId: "sess-1",
|
||||
};
|
||||
expect(req.kind).toBe("overlay.interrupt");
|
||||
expect(req.sessionId).toBe("sess-1");
|
||||
});
|
||||
|
||||
it("OverlayInterruptResponse carries ok flag", () => {
|
||||
const res: OverlayInterruptResponse = { ok: true };
|
||||
expect(res.ok).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("isOverlayAgentOverlayResetMessage", () => {
|
||||
it("accepts reset messages with a session id", () => {
|
||||
expect(
|
||||
isOverlayAgentOverlayResetMessage({
|
||||
type: OVERLAY_AGENT_OVERLAY_RESET,
|
||||
sessionId: "sess-1",
|
||||
}),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects reset messages without a session id", () => {
|
||||
expect(
|
||||
isOverlayAgentOverlayResetMessage({
|
||||
type: OVERLAY_AGENT_OVERLAY_RESET,
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user