feat(core): jobs, scheduler, plugin registry, connections
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
207c92bb4d
commit
166b8ecb5e
@@ -0,0 +1,24 @@
|
||||
import { expect, spyOn, test } from "bun:test";
|
||||
import { join } from "node:path";
|
||||
import { loadPlugins } from "../src/registry.ts";
|
||||
|
||||
const dir = join(import.meta.dir, "fixtures/plugins");
|
||||
|
||||
test("registry loads echo plugin and skips broken one", async () => {
|
||||
const warn = spyOn(console, "warn").mockImplementation(() => {});
|
||||
const reg = await loadPlugins([dir, join(dir, "does-not-exist")]);
|
||||
expect(reg.list().map((m) => m.id)).toEqual(["echo"]);
|
||||
expect(reg.get("echo")?.manifest.name).toBe("Echo");
|
||||
expect(reg.get("broken")).toBeUndefined();
|
||||
expect(warn.mock.calls.some((c) => String(c[0]).includes("broken"))).toBe(true);
|
||||
await reg.reload();
|
||||
expect(reg.list()).toHaveLength(1);
|
||||
warn.mockRestore();
|
||||
});
|
||||
|
||||
test("duplicate ids across dirs keep the first", async () => {
|
||||
const warn = spyOn(console, "warn").mockImplementation(() => {});
|
||||
const reg = await loadPlugins([dir, dir]);
|
||||
expect(reg.list()).toHaveLength(1);
|
||||
warn.mockRestore();
|
||||
});
|
||||
Reference in New Issue
Block a user