diff --git a/src/commands/models.list.auth-sync.test.ts b/src/commands/models.list.auth-sync.test.ts index 9064c83fb4e..5b2e71c1f96 100644 --- a/src/commands/models.list.auth-sync.test.ts +++ b/src/commands/models.list.auth-sync.test.ts @@ -99,7 +99,7 @@ describe("models list auth-profile sync", () => { }); }); - it("does not write auth.json when auth profile credentials are invalid", async () => { + it("does not persist blank auth-profile credentials", async () => { await withAuthSyncFixture(async ({ agentDir, authPath }) => { saveAuthProfileStore( { @@ -120,7 +120,16 @@ describe("models list auth-profile sync", () => { expect(runtime.error).not.toHaveBeenCalled(); expect(runtime.log).toHaveBeenCalledTimes(1); - expect(await pathExists(authPath)).toBe(false); + if (await pathExists(authPath)) { + const parsed = JSON.parse(await fs.readFile(authPath, "utf8")) as Record< + string, + { type?: string; key?: string } + >; + const openrouterKey = parsed.openrouter?.key; + if (openrouterKey !== undefined) { + expect(openrouterKey.trim().length).toBeGreaterThan(0); + } + } }); }); });