

























@@ -106,8 +106,12 @@ describe("auth profile store cache", () => {
106106const first = ensureAuthProfileStore(agentDir);
107107const second = ensureAuthProfileStore(agentDir);
108108109-expect(first.profiles["openai-codex:default"]).toMatchObject({ access: "access-1" });
110-expect(second.profiles["openai-codex:default"]).toMatchObject({ access: "access-2" });
109+expect((first.profiles["openai-codex:default"] as OAuthCredential | undefined)?.access).toBe(
110+"access-1",
111+);
112+expect((second.profiles["openai-codex:default"] as OAuthCredential | undefined)?.access).toBe(
113+"access-2",
114+);
111115expect(mocks.resolveExternalCliAuthProfiles).toHaveBeenCalledTimes(2);
112116});
113117});
@@ -124,9 +128,9 @@ describe("auth profile store cache", () => {
124128125129const reloaded = ensureAuthProfileStore(agentDir);
126130127-expect(reloaded.profiles["openai:default"]).toMatchObject({
128-key: "sk-test-2",
129-});
131+expect((reloaded.profiles["openai:default"] as { key?: string } | undefined)?.key).toBe(
132+"sk-test-2",
133+);
130134});
131135});
132136@@ -147,9 +151,9 @@ describe("auth profile store cache", () => {
147151};
148152149153const second = ensureAuthProfileStore(agentDir);
150-expect(second.profiles["openai:default"]).toMatchObject({
151-key: "sk-test",
152-});
154+expect((second.profiles["openai:default"] as { key?: string } | undefined)?.key).toBe(
155+"sk-test",
156+);
153157expect(second.profiles["anthropic:default"]).toBeUndefined();
154158expect(structuredCloneSpy).not.toHaveBeenCalled();
155159});
@@ -162,7 +166,9 @@ describe("auth profile store cache", () => {
162166await withAgentDirEnv("openclaw-auth-store-missing-", (agentDir) => {
163167const store = ensureAuthProfileStore(agentDir);
164168165-expect(store.profiles["openai-codex:default"]).toMatchObject({ access: "access-1" });
169+expect((store.profiles["openai-codex:default"] as OAuthCredential | undefined)?.access).toBe(
170+"access-1",
171+);
166172expect(fs.existsSync(path.join(agentDir, "auth-profiles.json"))).toBe(false);
167173});
168174});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。