summaryrefslogtreecommitdiff
path: root/std/ws/test.ts
diff options
context:
space:
mode:
authorSuguru Motegi <suguru.motegi@gmail.com>2020-02-24 13:37:15 -0800
committerGitHub <noreply@github.com>2020-02-24 16:37:15 -0500
commit79c6e052ed29b9b78c31f2e01da3b91f76b6a017 (patch)
tree8b69667d233fbf6841a55ec2d41bb9ae432e677e /std/ws/test.ts
parentf4fd433e1aa6c8c086c38df39c39bec23c56a29c (diff)
fix: createSecKey logic (#4063)
Diffstat (limited to 'std/ws/test.ts')
-rw-r--r--std/ws/test.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/std/ws/test.ts b/std/ws/test.ts
index 5a0ff9929..3f5475c80 100644
--- a/std/ws/test.ts
+++ b/std/ws/test.ts
@@ -8,6 +8,7 @@ import {
acceptable,
connectWebSocket,
createSecAccept,
+ createSecKey,
handshake,
OpCode,
readFrame,
@@ -328,6 +329,13 @@ test("WebSocket.send(), WebSocket.ping() should be exclusive", async (): Promise
assertEquals(bytes.equal(third.payload, new Uint8Array([3])), true);
});
+test(function createSecKeyHasCorrectLength(): void {
+ // Note: relies on --seed=86 being passed to deno to reproduce failure in
+ // #4063.
+ const secKey = createSecKey();
+ assertEquals(atob(secKey).length, 16);
+});
+
test("WebSocket should throw SocketClosedError when peer closed connection without close frame", async () => {
const buf = new Buffer();
const eofReader: Deno.Reader = {