Files
CapaKraken/packages/api/src/__tests__/assistant-tools-dashboard-skill-gaps.test.ts
T

39 lines
1.3 KiB
TypeScript

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 }],
});
});
});