From 60195ab0f2bfc5d17b236c97f3d2ec6e57b750bb Mon Sep 17 00:00:00 2001 From: fraisai Date: Sun, 14 Jan 2024 18:09:23 -0500 Subject: [PATCH] added unit tests for websocket connection --- lib/__tests__/unit/server.unit.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/__tests__/unit/server.unit.test.ts b/lib/__tests__/unit/server.unit.test.ts index 7d7d39b..426c245 100644 --- a/lib/__tests__/unit/server.unit.test.ts +++ b/lib/__tests__/unit/server.unit.test.ts @@ -101,12 +101,12 @@ describe('WebSocket checks', () => { expect(() => new WebSocket('typo')).toThrow(SyntaxError); - expect(() => new WebSocket('invalid://websocket-echo.com')).toThrow(new Error('The URL\'s protocol must be one of "ws:", "wss:", ' + '"http:", "https", or "ws+unix:"')); + expect(() => new WebSocket('invalid://websocket-echo.com')).toThrow(new Error('The URL\'s protocol must be one of "ws:", "wss:", or "ws+unix:"')); // URL's pathname is empty expect(() => new WebSocket('ws+unix:')).toThrow(SyntaxError); - expect(() => new WebSocket('wss://websocket-echo.com#foo')).toThrow(/^SyntaxError: The URL contains a fragment identifier$/); + expect(() => new WebSocket('wss://websocket-echo.com#foo')).toThrow(/The URL contains a fragment identifier/); }); afterAll((done) => {