
























@@ -226,20 +226,21 @@ describe("secrets runtime snapshot core lanes", () => {
226226}),
227227});
228228229-expect(snapshot.warnings.map((warning) => warning.path)).toEqual(
230-expect.arrayContaining([
231-"/tmp/openclaw-agent-main.auth-profiles.openai:default.key",
232-"/tmp/openclaw-agent-main.auth-profiles.github-copilot:default.token",
233-]),
229+const warningPaths = snapshot.warnings.map((warning) => warning.path);
230+expect(warningPaths).toContain("/tmp/openclaw-agent-main.auth-profiles.openai:default.key");
231+expect(warningPaths).toContain(
232+"/tmp/openclaw-agent-main.auth-profiles.github-copilot:default.token",
234233);
235-expect(snapshot.authStores[0]?.store.profiles["openai:default"]).toMatchObject({
236-type: "api_key",
237-key: "sk-env-openai",
238-});
239-expect(snapshot.authStores[0]?.store.profiles["github-copilot:default"]).toMatchObject({
240-type: "token",
241-token: "ghp-env-token",
242-});
234+const openAiProfile = snapshot.authStores[0]?.store.profiles["openai:default"] as
235+| Record<string, unknown>
236+| undefined;
237+expect(openAiProfile?.type).toBe("api_key");
238+expect(openAiProfile?.key).toBe("sk-env-openai");
239+const copilotProfile = snapshot.authStores[0]?.store.profiles["github-copilot:default"] as
240+| Record<string, unknown>
241+| undefined;
242+expect(copilotProfile?.type).toBe("token");
243+expect(copilotProfile?.token).toBe("ghp-env-token");
243244});
244245245246it("resolves inline placeholder auth profiles to env refs", async () => {
@@ -260,13 +261,11 @@ describe("secrets runtime snapshot core lanes", () => {
260261}),
261262});
262263263-expect(snapshot.authStores[0]?.store.profiles["openai:inline"]).toMatchObject({
264-type: "api_key",
265-key: "sk-env-openai",
266-});
267264const inlineProfile = snapshot.authStores[0]?.store.profiles["openai:inline"] as
268265| Record<string, unknown>
269266| undefined;
267+expect(inlineProfile?.type).toBe("api_key");
268+expect(inlineProfile?.key).toBe("sk-env-openai");
270269expect(inlineProfile?.keyRef).toEqual({
271270source: "env",
272271provider: "default",
@@ -285,11 +284,10 @@ describe("secrets runtime snapshot core lanes", () => {
285284const prepared = await prepareOpenAiRuntimeSnapshot();
286285activateSecretsRuntimeSnapshot(prepared);
287286288-expect(
289-ensureAuthProfileStore("/tmp/openclaw-agent-main").profiles["openai:default"],
290-).toMatchObject({
291-type: "api_key",
292-key: "sk-runtime",
293-});
287+const runtimeProfile = ensureAuthProfileStore("/tmp/openclaw-agent-main").profiles[
288+"openai:default"
289+] as Record<string, unknown> | undefined;
290+expect(runtimeProfile?.type).toBe("api_key");
291+expect(runtimeProfile?.key).toBe("sk-runtime");
294292});
295293});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。