summaryrefslogtreecommitdiff
path: root/cli/tests/websocket_test.ts
diff options
context:
space:
mode:
authorDjDeveloper <43033058+DjDeveloperr@users.noreply.github.com>2021-02-21 22:21:46 +0530
committerGitHub <noreply@github.com>2021-02-21 17:51:46 +0100
commitfe1b512820cbdfd2b93ddfc8e935556878339425 (patch)
tree2d0bac58a55291a8f0275bcbe68ae4a432ca5626 /cli/tests/websocket_test.ts
parenteefd522f0490f9bb829de9342dcd1ed7aeacb42a (diff)
fix(op_crates/websocket): default to close code 1005 (#9339)
Currently if WebSocket is closed without code, it will error while on Chrome it would close with code 1005 instead. Co-authored-by: crowlKats <13135287+crowlKats@users.noreply.github.com>
Diffstat (limited to 'cli/tests/websocket_test.ts')
-rw-r--r--cli/tests/websocket_test.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/cli/tests/websocket_test.ts b/cli/tests/websocket_test.ts
index b5f865943..8a7fc812c 100644
--- a/cli/tests/websocket_test.ts
+++ b/cli/tests/websocket_test.ts
@@ -295,3 +295,14 @@ Deno.test("Event Handlers order", async () => {
};
await promise;
});
+
+Deno.test("Close without frame", async () => {
+ const promise = deferred();
+ const ws = new WebSocket("ws://localhost:4244");
+ ws.onerror = (): void => fail();
+ ws.onclose = (e): void => {
+ assertEquals(e.code, 1005);
+ promise.resolve();
+ };
+ await promise;
+});