Files
mosaic/plugins/openclaw-context/tests/register.test.ts
Jason Woltje d583dd39c8 feat(wave2): add @mosaic/openclaw-context plugin to monorepo
- OpenClaw → OpenBrain context engine plugin migrated from mosaic/openclaw-openbrain-context
- Depends on @mosaic/types workspace:*
- Typecheck passing
2026-03-06 18:33:09 -06:00

31 lines
893 B
TypeScript

import { describe, expect, it, vi } from "vitest";
import { OPENBRAIN_CONTEXT_ENGINE_ID, register } from "../src/index.js";
describe("plugin register()", () => {
it("registers the openbrain context engine factory", async () => {
const registerContextEngine = vi.fn();
register({
registerContextEngine,
pluginConfig: {
baseUrl: "https://brain.example.com",
apiKey: "secret",
},
logger: {
debug: vi.fn(),
info: vi.fn(),
warn: vi.fn(),
error: vi.fn(),
},
});
expect(registerContextEngine).toHaveBeenCalledTimes(1);
const [id, factory] = registerContextEngine.mock.calls[0] as [string, () => Promise<unknown> | unknown];
expect(id).toBe(OPENBRAIN_CONTEXT_ENGINE_ID);
const engine = await factory();
expect(engine).toHaveProperty("info.id", OPENBRAIN_CONTEXT_ENGINE_ID);
});
});