From d05ba708e21267071975e3f13c79e6cc7724b5e5 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 10 Feb 2026 08:41:11 +0000 Subject: [PATCH] Cover no-auth wrong-path unauthorized non-eviction Co-authored-by: Theo Browne --- apps/t3/src/runtimeApiServer.test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/apps/t3/src/runtimeApiServer.test.ts b/apps/t3/src/runtimeApiServer.test.ts index 07746f946d..c7bdff0846 100644 --- a/apps/t3/src/runtimeApiServer.test.ts +++ b/apps/t3/src/runtimeApiServer.test.ts @@ -1256,6 +1256,19 @@ describe("runtimeApiServer", () => { expect(unauthorizedWrongTokenKeyClose.code).toBe(WS_CLOSE_CODES.unauthorized); expect(unauthorizedWrongTokenKeyClose.reason).toBe(WS_CLOSE_REASONS.unauthorized); + const baseUrl = new URL(server.wsUrl); + const unauthorizedWrongPathClient = new WebSocket(`${baseUrl.origin}/unexpected`); + const unauthorizedWrongPathClose = await withTimeout( + new Promise<{ code: number; reason: string }>((resolve, reject) => { + unauthorizedWrongPathClient.once("close", (code, reason) => + resolve({ code, reason: reason.toString() }), + ); + unauthorizedWrongPathClient.once("error", (error) => reject(error)); + }), + ); + expect(unauthorizedWrongPathClose.code).toBe(WS_CLOSE_CODES.unauthorized); + expect(unauthorizedWrongPathClose.reason).toBe(WS_CLOSE_REASONS.unauthorized); + const response = await sendRequest( activeClient.socket, activeClient.nextMessage,