diff options
Diffstat (limited to 'ws/test.ts')
-rw-r--r-- | ws/test.ts | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ws/test.ts b/ws/test.ts index b8eb42803..4351a391b 100644 --- a/ws/test.ts +++ b/ws/test.ts @@ -1,9 +1,10 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import { BufReader } from "../io/bufio.ts"; -import { assert, assertEquals } from "../testing/asserts.ts"; +import { assert, assertEquals, assertThrowsAsync } from "../testing/asserts.ts"; import { runIfMain, test } from "../testing/mod.ts"; import { acceptable, + connectWebSocket, createSecAccept, OpCode, readFrame, @@ -46,7 +47,6 @@ test(async function wsReadMaskedTextFrame(): Promise<void> { ) ); const frame = await readFrame(buf); - console.dir(frame); assertEquals(frame.opcode, OpCode.TextFrame); unmask(frame.payload, frame.mask); assertEquals(new Buffer(frame.payload).toString(), "Hello"); @@ -192,6 +192,16 @@ test(function wsAcceptableInvalid(): void { ); }); +test("connectWebSocket should throw invalid scheme of url", async (): Promise< + void +> => { + await assertThrowsAsync( + async (): Promise<void> => { + await connectWebSocket("file://hoge/hoge"); + } + ); +}); + test(async function wsWriteReadMaskedFrame(): Promise<void> { const mask = new Uint8Array([0, 1, 2, 3]); const msg = "hello"; |