Cover no-auth wrong-path unauthorized non-eviction
Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
1 parent
3cab8e6602
commit
d05ba708e2
1 file changed
+13
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user