import { expect } from "@std/expect"; import { describe, it } from "@std/testing/bdd"; import { HOST_ORIGIN } from "../src/csp.ts"; import outerFrame, { outerFrameDocument } from "../src/outer-frame.ts"; describe("outer-frame", () => { describe("outerFrameDocument()", () => { it("returns a document carrying the script and the host's origin", () => { const document = outerFrameDocument("toHost({ type: 'probe' });"); expect(document).toContain( ``", () => { expect(() => outerFrameDocument("x = '';")).toThrow( "must not contain", ); }); it("throws given a script carrying ` { expect(() => outerFrameDocument("x = ' { it("is a document carrying the outer frame's script", () => { expect(outerFrame).toContain("function toHost("); }); }); });