import { afterEach, describe, expect, it } from "vitest"; import { createTestSession, type TestSession } from "../../../test/harness"; import splitForkExtension, { __test } from "../index"; let t: TestSession | undefined; afterEach(() => { t?.dispose(); t = undefined; }); describe("split-fork extension", () => { it("loads in real Pi extension runtime", async () => { t = await createTestSession({ extensionFactories: [splitForkExtension] }); expect(t.session.extensionRunner.extensions).toHaveLength(1); }); it("shell quotes prompt-safe command parts", () => { expect(__test.shellQuote("can't")).toBe("'can'\"'\"'t'"); expect(__test.shellQuote("")).toBe("''"); }); it("builds startup input with session and prompt", () => { const startup = __test.buildPiStartupInput( "/tmp/session.jsonl", "review this", ); expect(startup).toContain("'--session' '/tmp/session.jsonl'"); expect(startup).toContain("'--' 'review this'"); expect(startup.endsWith("\n")).toBe(true); }); });