From 263126cb5c75fc1b570b2822b6af281ddb8f3dc0 Mon Sep 17 00:00:00 2001 From: Git-on-my-level <9387252+Git-on-my-level@users.noreply.github.com> Date: Sun, 26 Jul 2026 18:27:47 +0000 Subject: [PATCH] test(auth-broker): assert canonical rejection class --- packages/ai/test/auth-broker-wire.test.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/ai/test/auth-broker-wire.test.ts b/packages/ai/test/auth-broker-wire.test.ts index acd51ec17..971d0da7e 100644 --- a/packages/ai/test/auth-broker-wire.test.ts +++ b/packages/ai/test/auth-broker-wire.test.ts @@ -5,6 +5,7 @@ import * as path from "node:path"; import { AuthStorage, REMOTE_REFRESH_SENTINEL, SqliteAuthCredentialStore } from "@oh-my-pi/pi-ai"; import { AuthBrokerClient, + AuthBrokerError, type AuthBrokerServerHandle, AuthBrokerStreamUnsupportedError, type SnapshotStreamEvent, @@ -108,7 +109,13 @@ describe("auth-broker wire surface", () => { }) as typeof fetch, }); - await expect(client.fetchSnapshot({ signal: AbortSignal.timeout(10) })).rejects.toMatchObject({ status: 401 }); + try { + await client.fetchSnapshot({ signal: AbortSignal.timeout(10) }); + throw new Error("expected auth rejection"); + } catch (error) { + expect(error).toBeInstanceOf(AuthBrokerError); + expect(error).toMatchObject({ status: 401 }); + } }); test("GET /v1/snapshot returns generation headers and 304 for unchanged long-poll", async () => {