test(api): cover assistant skill gap tool routing
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { SystemRole } from "@capakraken/shared";
|
||||
|
||||
import {
|
||||
createToolContext,
|
||||
executeTool,
|
||||
getDashboardSkillGapSummary,
|
||||
} from "./assistant-tools-dashboard-test-helpers.js";
|
||||
|
||||
describe("assistant dashboard tools skill gaps", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it("routes skill gap reads through the dashboard router path", async () => {
|
||||
vi.mocked(getDashboardSkillGapSummary).mockResolvedValue({
|
||||
roleGaps: [
|
||||
{ role: "Pipeline TD", needed: 4, filled: 1, gap: 3, fillRate: 25 },
|
||||
],
|
||||
totalOpenPositions: 3,
|
||||
skillSupplyTop10: [{ skill: "houdini", resourceCount: 5 }],
|
||||
resourcesByRole: [{ role: "Pipeline TD", count: 2 }],
|
||||
});
|
||||
|
||||
const ctx = createToolContext({}, { userRole: SystemRole.CONTROLLER });
|
||||
const result = await executeTool("get_skill_gaps", "{}", ctx);
|
||||
|
||||
expect(getDashboardSkillGapSummary).toHaveBeenCalledTimes(1);
|
||||
expect(JSON.parse(result.content)).toEqual({
|
||||
roleGaps: [
|
||||
{ role: "Pipeline TD", needed: 4, filled: 1, gap: 3, fillRate: 25 },
|
||||
],
|
||||
totalOpenPositions: 3,
|
||||
skillSupplyTop10: [{ skill: "houdini", resourceCount: 5 }],
|
||||
resourcesByRole: [{ role: "Pipeline TD", count: 2 }],
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user