@@ -120,7 +120,7 @@ describe("writeOAuthCredentials", () => {
|
120 | 120 | |
121 | 121 | await expect( |
122 | 122 | fs.readFile(path.join(env.agentDir, "auth-profiles.json"), "utf8"), |
123 | | -).rejects.toThrow(); |
| 123 | +).rejects.toMatchObject({ code: "ENOENT" }); |
124 | 124 | }); |
125 | 125 | |
126 | 126 | it("writes OAuth credentials to all sibling agent dirs when syncSiblingAgents=true", async () => { |
@@ -189,7 +189,9 @@ describe("writeOAuthCredentials", () => {
|
189 | 189 | type: "oauth", |
190 | 190 | }); |
191 | 191 | |
192 | | -await expect(fs.readFile(authProfilePathFor(mainAgentDir), "utf8")).rejects.toThrow(); |
| 192 | +await expect(fs.readFile(authProfilePathFor(mainAgentDir), "utf8")).rejects.toMatchObject({ |
| 193 | +code: "ENOENT", |
| 194 | +}); |
193 | 195 | }); |
194 | 196 | |
195 | 197 | it("syncs siblings from explicit agentDir outside OPENCLAW_STATE_DIR", async () => { |
@@ -230,7 +232,9 @@ describe("writeOAuthCredentials", () => {
|
230 | 232 | |
231 | 233 | // Global state dir should NOT have credentials written |
232 | 234 | const globalMain = path.join(tempStateDir, "agents", "main", "agent"); |
233 | | -await expect(fs.readFile(authProfilePathFor(globalMain), "utf8")).rejects.toThrow(); |
| 235 | +await expect(fs.readFile(authProfilePathFor(globalMain), "utf8")).rejects.toMatchObject({ |
| 236 | +code: "ENOENT", |
| 237 | +}); |
234 | 238 | }); |
235 | 239 | }); |
236 | 240 | |
@@ -409,7 +413,7 @@ describe("upsertApiKeyProfile", () => {
|
409 | 413 | |
410 | 414 | await expect( |
411 | 415 | fs.readFile(path.join(env.agentDir, "auth-profiles.json"), "utf8"), |
412 | | -).rejects.toThrow(); |
| 416 | +).rejects.toMatchObject({ code: "ENOENT" }); |
413 | 417 | }); |
414 | 418 | }); |
415 | 419 | |
|