mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 19:54:46 +00:00
test: tighten extension auth assertions
This commit is contained in:
@@ -325,24 +325,26 @@ describe("anthropic cli migration", () => {
|
||||
},
|
||||
};
|
||||
|
||||
await expect(
|
||||
method.runNonInteractive?.(createProviderAuthMethodNonInteractiveContext(config)),
|
||||
).resolves.toMatchObject({
|
||||
agents: {
|
||||
defaults: {
|
||||
model: {
|
||||
primary: "anthropic/claude-opus-4-7",
|
||||
fallbacks: ["anthropic/claude-opus-4-6", "openai/gpt-5.2"],
|
||||
},
|
||||
agentRuntime: { id: "claude-cli" },
|
||||
models: {
|
||||
"anthropic/claude-opus-4-7": { alias: "Opus" },
|
||||
"anthropic/claude-opus-4-6": { alias: "Opus" },
|
||||
"openai/gpt-5.2": {},
|
||||
},
|
||||
},
|
||||
},
|
||||
const result = await method.runNonInteractive?.(
|
||||
createProviderAuthMethodNonInteractiveContext(config),
|
||||
);
|
||||
const defaults = result?.agents?.defaults as
|
||||
| {
|
||||
model?: { primary?: string; fallbacks?: string[] };
|
||||
agentRuntime?: { id?: string };
|
||||
models?: Record<string, unknown>;
|
||||
}
|
||||
| undefined;
|
||||
expect(defaults?.model?.primary).toBe("anthropic/claude-opus-4-7");
|
||||
expect(defaults?.model?.fallbacks).toEqual(["anthropic/claude-opus-4-6", "openai/gpt-5.2"]);
|
||||
expect(defaults?.agentRuntime?.id).toBe("claude-cli");
|
||||
expect(defaults?.models?.["anthropic/claude-opus-4-7"]).toEqual({
|
||||
alias: "Opus",
|
||||
});
|
||||
expect(defaults?.models?.["anthropic/claude-opus-4-6"]).toEqual({
|
||||
alias: "Opus",
|
||||
});
|
||||
expect(defaults?.models?.["openai/gpt-5.2"]).toEqual({});
|
||||
});
|
||||
|
||||
it("registered non-interactive cli auth reports missing local auth and exits cleanly", async () => {
|
||||
|
||||
@@ -114,9 +114,7 @@ describe("githubCopilotMemoryEmbeddingProviderAdapter", () => {
|
||||
const result = await githubCopilotMemoryEmbeddingProviderAdapter.create(defaultCreateOptions());
|
||||
|
||||
expect(result.provider?.model).toBe("text-embedding-3-small");
|
||||
expect(resolveCopilotApiTokenMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ githubToken: "gh_test_token_123" }),
|
||||
);
|
||||
expect(resolveCopilotApiTokenMock.mock.calls[0]?.[0]?.githubToken).toBe("gh_test_token_123");
|
||||
});
|
||||
|
||||
it("matches embedding-capable models when supported_endpoints is missing or malformed", async () => {
|
||||
@@ -214,12 +212,8 @@ describe("githubCopilotMemoryEmbeddingProviderAdapter", () => {
|
||||
} as never);
|
||||
|
||||
expect(resolveFirstGithubTokenMock).toHaveBeenCalled();
|
||||
expect(resolveCopilotApiTokenMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
env: process.env,
|
||||
githubToken: "gh_remote_token",
|
||||
}),
|
||||
);
|
||||
expect(resolveCopilotApiTokenMock.mock.calls[0]?.[0]?.env).toBe(process.env);
|
||||
expect(resolveCopilotApiTokenMock.mock.calls[0]?.[0]?.githubToken).toBe("gh_remote_token");
|
||||
|
||||
const discoveryCall = fetchWithSsrFGuardMock.mock.calls[0]?.[0] as {
|
||||
init: { headers: Record<string, string> };
|
||||
|
||||
@@ -167,23 +167,20 @@ describe("slackApprovalNativeRuntime", () => {
|
||||
phase: "resolved",
|
||||
});
|
||||
|
||||
expect(chatUpdate).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
expect.objectContaining({
|
||||
channel: "C123",
|
||||
ts: "1712345678.999999",
|
||||
text: "a".repeat(SLACK_CHAT_UPDATE_TEXT_LIMIT),
|
||||
blocks,
|
||||
}),
|
||||
);
|
||||
expect(chatUpdate).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
channel: "C123",
|
||||
ts: "1712345678.999999",
|
||||
text: expect.stringMatching(/…$/),
|
||||
blocks,
|
||||
}),
|
||||
);
|
||||
const firstUpdate = chatUpdate.mock.calls[0]?.[0] as
|
||||
| { channel?: string; ts?: string; text?: string; blocks?: unknown }
|
||||
| undefined;
|
||||
const secondUpdate = chatUpdate.mock.calls[1]?.[0] as
|
||||
| { channel?: string; ts?: string; text?: string; blocks?: unknown }
|
||||
| undefined;
|
||||
expect(firstUpdate?.channel).toBe("C123");
|
||||
expect(firstUpdate?.ts).toBe("1712345678.999999");
|
||||
expect(firstUpdate?.text).toBe("a".repeat(SLACK_CHAT_UPDATE_TEXT_LIMIT));
|
||||
expect(firstUpdate?.blocks).toBe(blocks);
|
||||
expect(secondUpdate?.channel).toBe("C123");
|
||||
expect(secondUpdate?.ts).toBe("1712345678.999999");
|
||||
expect(secondUpdate?.text).toMatch(/…$/);
|
||||
expect(secondUpdate?.blocks).toBe(blocks);
|
||||
expect(chatUpdate.mock.calls[1]?.[0].text).toHaveLength(SLACK_CHAT_UPDATE_TEXT_LIMIT);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user