test(api): cover isolated dashboard skill gap detail
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user