test: tighten deepinfra onboard assertions

This commit is contained in:
Peter Steinberger
2026-05-09 09:18:53 +01:00
parent 7541b8f4b6
commit 14ce958eaf

View File

@@ -44,7 +44,7 @@ describe("DeepInfra provider config", () => {
it("sets DeepInfra alias on the provided model ref", () => {
const result = applyDeepInfraProviderConfig(emptyCfg, DEEPINFRA_DEFAULT_MODEL_REF);
const agentModel = result.agents?.defaults?.models?.[DEEPINFRA_DEFAULT_MODEL_REF];
expect(agentModel).toMatchObject({ alias: "DeepInfra" });
expect(agentModel).toEqual({ alias: "DeepInfra" });
});
it("attaches the alias to a non-default model ref when provided", () => {
@@ -115,10 +115,8 @@ describe("DeepInfra provider config", () => {
try {
const result = resolveEnvApiKey("deepinfra");
expect(result).toMatchObject({
apiKey: "test-deepinfra-key",
source: expect.stringContaining("DEEPINFRA_API_KEY"),
});
expect(result?.apiKey).toBe("test-deepinfra-key");
expect(result?.source.endsWith("DEEPINFRA_API_KEY")).toBe(true);
} finally {
envSnapshot.restore();
}
@@ -153,10 +151,19 @@ describe("DeepInfra provider config", () => {
agentDir,
});
expect(spy).toHaveBeenCalledWith(expect.objectContaining({ provider: "deepinfra" }));
expect(auth.apiKey).toBe("deepinfra-provider-test-key");
expect(auth.mode).toBe("api-key");
expect(auth.source).toContain("DEEPINFRA_API_KEY");
expect(spy.mock.calls).toEqual([
[
{
provider: "deepinfra",
agentDir,
},
],
]);
expect(auth).toEqual({
apiKey: "deepinfra-provider-test-key",
source: "env: DEEPINFRA_API_KEY",
mode: "api-key",
});
} finally {
envSnapshot.restore();
}