This commit is contained in:
2026-03-15 20:08:10 -04:00
parent 33768b748c
commit 55a8c9432e
26 changed files with 3449 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
import { describe, expect, it } from "vitest";
import { createTestHarness } from "@paperclipai/plugin-sdk/testing";
import manifest from "../src/manifest.js";
import plugin from "../src/worker.js";
describe("plugin log viewer", () => {
it("registers data + actions and handles events", async () => {
const harness = createTestHarness({ manifest, capabilities: [...manifest.capabilities, "events.emit"] });
await plugin.definition.setup(harness.ctx);
await harness.emit("issue.created", { companyId: "comp_1" }, { entityId: "iss_1", entityType: "issue", companyId: "comp_1" });
const logs = await harness.getData<Array<{ eventType: string; entityId: string }>>("logs");
expect(logs).toBeDefined();
expect(logs.length).toBeGreaterThan(0);
expect(logs[0].eventType).toBe("issue.created");
expect(logs[0].entityId).toBe("iss_1");
const health = await harness.getData<{ status: string; logCount: number }>("health");
expect(health.status).toBe("ok");
expect(health.logCount).toBe(1);
const action = await harness.performAction<{ pong: boolean }>("ping");
expect(action.pong).toBe(true);
});
});