Add tool ranker fallback policy tests
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
const {ToolRankerFallbackPolicy} = await import("../dist/common/policies.js");
|
||||
const {resolveToolRankerFallbackSelection} = await import("../dist/ai/tool-ranker-fallback.js");
|
||||
|
||||
const availableToolNames = ["read_file", "search_files"];
|
||||
|
||||
test("tool ranker fallback returns no tools when policy is NO_TOOLS", () => {
|
||||
assert.deepEqual(
|
||||
resolveToolRankerFallbackSelection({
|
||||
fallbackPolicy: ToolRankerFallbackPolicy.NO_TOOLS,
|
||||
availableToolNames,
|
||||
}),
|
||||
{
|
||||
toolNames: [],
|
||||
usedRanker: false,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
test("tool ranker fallback returns all tools when policy is ALL_TOOLS", () => {
|
||||
assert.deepEqual(
|
||||
resolveToolRankerFallbackSelection({
|
||||
fallbackPolicy: ToolRankerFallbackPolicy.ALL_TOOLS,
|
||||
availableToolNames,
|
||||
}),
|
||||
{
|
||||
toolNames: ["read_file", "search_files"],
|
||||
usedRanker: false,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
test("tool ranker fallback keeps all tools when policy is MAIN_MODEL", () => {
|
||||
assert.deepEqual(
|
||||
resolveToolRankerFallbackSelection({
|
||||
fallbackPolicy: ToolRankerFallbackPolicy.MAIN_MODEL,
|
||||
availableToolNames,
|
||||
}),
|
||||
{
|
||||
toolNames: ["read_file", "search_files"],
|
||||
usedRanker: false,
|
||||
},
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user