test(api): cover isolated dashboard skill gap detail

This commit is contained in:
2026-03-31 23:49:33 +02:00
parent fa9c8b12b8
commit 24b5e60169
2 changed files with 73 additions and 0 deletions
@@ -417,4 +417,48 @@ describe("assistant dashboard tools detail aggregation", () => {
}, },
}); });
}); });
it("routes the isolated skill gap detail section without unrelated dashboard reads", 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(
{
systemSettings: {
findUnique: vi.fn().mockResolvedValue(null),
},
},
{ userRole: SystemRole.CONTROLLER },
);
const result = await executeTool(
"get_dashboard_detail",
JSON.stringify({ section: "skill_gaps" }),
ctx,
);
expect(JSON.parse(result.content)).toEqual({
skillGaps: {
totalOpenPositions: 3,
roleGaps: [
{ role: "Pipeline TD", gap: 3, needed: 4, filled: 1, fillRate: 25 },
],
topSkillsInSupply: [{ skill: "houdini", resourceCount: 5 }],
resourcesByRole: [{ role: "Pipeline TD", count: 2 }],
},
});
expect(getDashboardSkillGapSummary).toHaveBeenCalledTimes(1);
expect(getDashboardOverview).not.toHaveBeenCalled();
expect(getDashboardPeakTimes).not.toHaveBeenCalled();
expect(getDashboardDemand).not.toHaveBeenCalled();
expect(getDashboardProjectHealth).not.toHaveBeenCalled();
expect(getDashboardChargeabilityOverview).not.toHaveBeenCalled();
expect(getDashboardTopValueResources).not.toHaveBeenCalled();
});
}); });
@@ -127,6 +127,35 @@ describe("dashboard procedure support", () => {
}); });
}); });
it("builds the isolated skill gap detail section without overview reads", 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 result = await getDashboardDetail(createContext(), { section: "skill_gaps" });
expect(result).toEqual({
skillGaps: {
totalOpenPositions: 3,
roleGaps: [
{ role: "Pipeline TD", gap: 3, needed: 4, filled: 1, fillRate: 25 },
],
topSkillsInSupply: [{ skill: "houdini", resourceCount: 5 }],
resourcesByRole: [{ role: "Pipeline TD", count: 2 }],
},
});
expect(getDashboardSkillGapSummary).toHaveBeenCalledTimes(1);
expect(getDashboardOverview).not.toHaveBeenCalled();
expect(getDashboardPeakTimes).not.toHaveBeenCalled();
expect(getDashboardDemand).not.toHaveBeenCalled();
expect(getDashboardProjectHealth).not.toHaveBeenCalled();
});
it("builds the assistant-facing dashboard detail payload", async () => { it("builds the assistant-facing dashboard detail payload", async () => {
vi.useFakeTimers(); vi.useFakeTimers();
vi.setSystemTime(new Date("2026-03-15T00:00:00.000Z")); vi.setSystemTime(new Date("2026-03-15T00:00:00.000Z"));