From ed6f58ae1144eaf61fcce3e6055efaebcd9af8b4 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 10 Feb 2026 08:04:33 +0000 Subject: [PATCH] Cover no-auth wrong-token-key unauthorized non-eviction Co-authored-by: Theo Browne --- apps/t3/src/runtimeApiServer.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/t3/src/runtimeApiServer.test.ts b/apps/t3/src/runtimeApiServer.test.ts index cf1bc8da1c..b78cd72f8b 100644 --- a/apps/t3/src/runtimeApiServer.test.ts +++ b/apps/t3/src/runtimeApiServer.test.ts @@ -1244,6 +1244,18 @@ describe("runtimeApiServer", () => { expect(unauthorizedUnexpectedQueryClose.code).toBe(WS_CLOSE_CODES.unauthorized); expect(unauthorizedUnexpectedQueryClose.reason).toBe(WS_CLOSE_REASONS.unauthorized); + const unauthorizedWrongTokenKeyClient = new WebSocket(`${server.wsUrl}?Token=legacy-token`); + const unauthorizedWrongTokenKeyClose = await withTimeout( + new Promise<{ code: number; reason: string }>((resolve, reject) => { + unauthorizedWrongTokenKeyClient.once("close", (code, reason) => + resolve({ code, reason: reason.toString() }), + ); + unauthorizedWrongTokenKeyClient.once("error", (error) => reject(error)); + }), + ); + expect(unauthorizedWrongTokenKeyClose.code).toBe(WS_CLOSE_CODES.unauthorized); + expect(unauthorizedWrongTokenKeyClose.reason).toBe(WS_CLOSE_REASONS.unauthorized); + const response = await sendRequest( activeClient.socket, activeClient.nextMessage,