repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

pi/agent/extensions/web/__tests__/harness.test.ts

Raw
File outline
import { afterEach, describe, expect, it } from "bun:test";
import path from "node:path";
import { createTestSession, type TestSession } from "@marcfargas/pi-test-harness";

describe("web extension harness", () => {
  let t: TestSession | undefined;
  afterEach(() => t?.dispose());

  it("registers web_fetch, web_search, and understand_image tools", async () => {
    const webPath = path.resolve(import.meta.dir, "../index.ts");
    t = await createTestSession({ extensions: [webPath] });

    const [extension] = t.session.extensionRunner.extensions;
    expect([...extension.tools.keys()]).toContain("web_fetch");
    expect([...extension.tools.keys()]).toContain("web_search");
    expect([...extension.tools.keys()]).toContain("understand_image");
  });
});