mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 10:40:43 +00:00
test: tighten deepinfra onboard assertions
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user