agents: add tests for engine router
Test engine router switching logic between embedded and AI SDK engines.
This commit is contained in:
parent
bfee272ac6
commit
a0597d25e7
44
src/agents/engine-router.test.ts
Normal file
44
src/agents/engine-router.test.ts
Normal file
@ -0,0 +1,44 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getConfiguredEngine, getEngineInfo, DEFAULT_ENGINE } from "./engine-router.js";
|
||||
|
||||
describe("Engine Router", () => {
|
||||
describe("getConfiguredEngine", () => {
|
||||
it("returns aisdk by default when no config", () => {
|
||||
expect(getConfiguredEngine()).toBe("aisdk");
|
||||
});
|
||||
|
||||
it("returns aisdk by default when config has no engine", () => {
|
||||
expect(getConfiguredEngine({})).toBe("aisdk");
|
||||
expect(getConfiguredEngine({ agents: {} })).toBe("aisdk");
|
||||
});
|
||||
|
||||
it("returns pi-agent when configured", () => {
|
||||
expect(getConfiguredEngine({ agents: { engine: "pi-agent" } })).toBe("pi-agent");
|
||||
});
|
||||
|
||||
it("returns aisdk when explicitly configured", () => {
|
||||
expect(getConfiguredEngine({ agents: { engine: "aisdk" } })).toBe("aisdk");
|
||||
});
|
||||
});
|
||||
|
||||
describe("getEngineInfo", () => {
|
||||
it("returns current and default engine info", () => {
|
||||
const info = getEngineInfo();
|
||||
expect(info.current).toBe(DEFAULT_ENGINE);
|
||||
expect(info.default).toBe("aisdk");
|
||||
expect(info.configPath).toBe("agents.engine");
|
||||
});
|
||||
|
||||
it("reflects configured engine", () => {
|
||||
const info = getEngineInfo({ agents: { engine: "pi-agent" } });
|
||||
expect(info.current).toBe("pi-agent");
|
||||
expect(info.default).toBe("aisdk");
|
||||
});
|
||||
});
|
||||
|
||||
describe("DEFAULT_ENGINE", () => {
|
||||
it("is aisdk", () => {
|
||||
expect(DEFAULT_ENGINE).toBe("aisdk");
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user