


























@@ -5,11 +5,7 @@
55 */
66import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
77import type { ProviderExternalAuthProfile } from "../../plugins/types.js";
8-import {
9-testing,
10-overlayExternalAuthProfiles,
11-shouldPersistExternalAuthProfile,
12-} from "./external-auth.js";
8+import { testing, overlayExternalAuthProfiles } from "./external-auth.js";
139import { readManagedExternalCliCredential } from "./external-cli-sync.js";
1410import type { AuthProfileStore, OAuthCredential } from "./types.js";
1511@@ -134,61 +130,6 @@ describe("auth external oauth helpers", () => {
134130expect(overlaid.profiles["openai:work"]).toEqual(store.profiles["openai:work"]);
135131});
136132137-it("omits exact runtime-only overlays from persisted store writes", () => {
138-const credential = createCredential();
139-resolveExternalAuthProfilesWithPluginsMock.mockReturnValueOnce([
140-{
141-profileId: "openai:default",
142- credential,
143-},
144-]);
145-146-const shouldPersist = shouldPersistExternalAuthProfile({
147-store: createStore({ "openai:default": credential }),
148-profileId: "openai:default",
149- credential,
150-});
151-152-expect(shouldPersist).toBe(false);
153-});
154-155-it("keeps persisted copies when the external overlay is marked persisted", () => {
156-const credential = createCredential();
157-resolveExternalAuthProfilesWithPluginsMock.mockReturnValueOnce([
158-{
159-profileId: "openai:default",
160- credential,
161-persistence: "persisted",
162-},
163-]);
164-165-const shouldPersist = shouldPersistExternalAuthProfile({
166-store: createStore({ "openai:default": credential }),
167-profileId: "openai:default",
168- credential,
169-});
170-171-expect(shouldPersist).toBe(true);
172-});
173-174-it("keeps stale local copies when runtime overlay no longer matches", () => {
175-const credential = createCredential();
176-resolveExternalAuthProfilesWithPluginsMock.mockReturnValueOnce([
177-{
178-profileId: "openai:default",
179-credential: createCredential({ access: "fresh-access-token" }),
180-},
181-]);
182-183-const shouldPersist = shouldPersistExternalAuthProfile({
184-store: createStore({ "openai:default": credential }),
185-profileId: "openai:default",
186- credential,
187-});
188-189-expect(shouldPersist).toBe(true);
190-});
191-192133it("keeps Codex CLI OAuth from replacing stored inline token material", () => {
193134readCodexCliCredentialsCachedMock.mockReturnValue(
194135createCredential({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。