Cover no-auth wrong-token-key unauthorized non-eviction

Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
Cursor AgentandTheo Browne committed 2026-02-10 08:04:33 +00:00
1 parent f048627128
commit ed6f58ae11
1 file changed
+12
+12
View File
@@ -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,