@@ -108,10 +108,17 @@ describe("auth-store", () => {
|
108 | 108 | ); |
109 | 109 | |
110 | 110 | await expect(readWebAuthState(authDir)).resolves.toBe("linked"); |
111 | | -await expect(readWebAuthSnapshot(authDir)).resolves.toMatchObject({ |
| 111 | +const snapshot = await readWebAuthSnapshot(authDir); |
| 112 | +expect(snapshot.authAgeMs).toBeTypeOf("number"); |
| 113 | +expect(snapshot.authAgeMs).toBeGreaterThanOrEqual(0); |
| 114 | +expect(snapshot).toEqual({ |
112 | 115 | state: "linked", |
113 | | -authAgeMs: expect.any(Number), |
114 | | -selfId: expect.objectContaining({ e164: "+15551234567" }), |
| 116 | +authAgeMs: snapshot.authAgeMs, |
| 117 | +selfId: { |
| 118 | +e164: "+15551234567", |
| 119 | +jid: "15551234567@s.whatsapp.net", |
| 120 | +lid: null, |
| 121 | +}, |
115 | 122 | }); |
116 | 123 | }); |
117 | 124 | |
@@ -301,8 +308,12 @@ describe("auth-store", () => {
|
301 | 308 | it("throws a typed unstable-auth error when channel selection times out", async () => { |
302 | 309 | hoisted.waitForCredsSaveQueueWithTimeout.mockResolvedValueOnce("timed_out"); |
303 | 310 | |
304 | | -await expect(pickWebChannel("auto", "/tmp/openclaw-wa-auth-unstable")).rejects.toEqual( |
305 | | -expect.objectContaining({ |
| 311 | +const error = await pickWebChannel("auto", "/tmp/openclaw-wa-auth-unstable").catch( |
| 312 | +(caught: unknown) => caught, |
| 313 | +); |
| 314 | +expect(error).toBeInstanceOf(WhatsAppAuthUnstableError); |
| 315 | +expect(error).toEqual( |
| 316 | +Object.assign(new WhatsAppAuthUnstableError(), { |
306 | 317 | code: WHATSAPP_AUTH_UNSTABLE_CODE, |
307 | 318 | name: WhatsAppAuthUnstableError.name, |
308 | 319 | }), |
|