Skip to content

Commit

Permalink
added unit tests for websocket connection
Browse files Browse the repository at this point in the history
  • Loading branch information
fraisai committed Jan 14, 2024
1 parent 297b303 commit 60195ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/__tests__/unit/server.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 60195ab

Please sign in to comment.