import { afterEach, describe, expect, it } from "bun:test"; import { createTestSession, type TestSession, } from "@marcfargas/pi-test-harness"; let t: TestSession | undefined; function devilPath(): string { return new URL("../index.ts", import.meta.url).pathname; } afterEach(() => { t?.dispose(); t = undefined; }); describe("devil harness integration", () => { it("loads in real Pi extension runtime and registers command/flags", async () => { t = await createTestSession({ extensions: [devilPath()] }); const [extension] = t.session.extensionRunner.extensions; expect(extension.commands.has("devil")).toBe(true); expect(extension.flags.has("devil-rounds")).toBe(true); expect(extension.flags.has("devil-stop")).toBe(true); }); it("handles empty /devil command through real command dispatch", async () => { t = await createTestSession({ extensions: [devilPath()] }); await t.session.prompt("/devil"); const notify = t.events.uiCallsFor("notify"); expect(notify).toHaveLength(1); expect(notify[0].args).toEqual(["Usage: /devil ", "error"]); }); });