test: tighten provider usage plugin assertions

This commit is contained in:
Peter Steinberger
2026-05-09 13:11:43 +01:00
parent cc37c5d6b5
commit e5a102249f

View File

@@ -60,15 +60,23 @@ describe("provider-usage.load plugin boundary", () => {
});
expect(mockFetch).not.toHaveBeenCalled();
expect(resolveProviderUsageSnapshotWithPluginMock).toHaveBeenCalledWith(
expect.objectContaining({
provider: "github-copilot",
context: expect.objectContaining({
provider: "github-copilot",
token: "copilot-token",
timeoutMs: 5_000,
}),
}),
);
expect(resolveProviderUsageSnapshotWithPluginMock).toHaveBeenCalledOnce();
const pluginCall = resolveProviderUsageSnapshotWithPluginMock.mock.calls[0]?.[0] as
| {
provider?: unknown;
context?: {
provider?: unknown;
token?: unknown;
timeoutMs?: unknown;
};
}
| undefined;
if (!pluginCall) {
throw new Error("missing provider usage plugin call");
}
expect(pluginCall.provider).toBe("github-copilot");
expect(pluginCall.context?.provider).toBe("github-copilot");
expect(pluginCall.context?.token).toBe("copilot-token");
expect(pluginCall.context?.timeoutMs).toBe(5_000);
});
});