From 6c813bd32bab1fd8113ab78887843a70038cdcd0 Mon Sep 17 00:00:00 2001 From: Brian Mendonca Date: Sat, 21 Feb 2026 15:36:10 -0700 Subject: [PATCH] test: avoid asserting auth.json absence for invalid profile creds --- src/commands/models.list.auth-sync.test.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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); + } + } }); }); });