From b95f79d74cbcf3492abd95d4c90839e32f51399f Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Thu, 23 May 2019 19:04:06 -0700 Subject: io: refactor BufReader/Writer interfaces to be more idiomatic (denoland/deno_std#444) Thanks Vincent Le Goff (@zekth) for porting over the CSV reader implementation. Fixes: denoland/deno_std#436 Original: https://github.com/denoland/deno_std/commit/0ee6334b698072b50c6f5ac8d42d34dc4c94b948 --- ws/test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ws/test.ts') diff --git a/ws/test.ts b/ws/test.ts index 93936988a..bac82453d 100644 --- a/ws/test.ts +++ b/ws/test.ts @@ -107,8 +107,9 @@ test(async function wsReadUnmaskedPingPongFrame(): Promise { }); test(async function wsReadUnmaskedBigBinaryFrame(): Promise { + const payloadLength = 0x100; const a = [0x82, 0x7e, 0x01, 0x00]; - for (let i = 0; i < 256; i++) { + for (let i = 0; i < payloadLength; i++) { a.push(i); } const buf = new BufReader(new Buffer(new Uint8Array(a))); @@ -116,12 +117,13 @@ test(async function wsReadUnmaskedBigBinaryFrame(): Promise { assertEquals(bin.opcode, OpCode.BinaryFrame); assertEquals(bin.isLastFrame, true); assertEquals(bin.mask, undefined); - assertEquals(bin.payload.length, 256); + assertEquals(bin.payload.length, payloadLength); }); test(async function wsReadUnmaskedBigBigBinaryFrame(): Promise { + const payloadLength = 0x10000; const a = [0x82, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00]; - for (let i = 0; i < 0xffff; i++) { + for (let i = 0; i < payloadLength; i++) { a.push(i); } const buf = new BufReader(new Buffer(new Uint8Array(a))); @@ -129,7 +131,7 @@ test(async function wsReadUnmaskedBigBigBinaryFrame(): Promise { assertEquals(bin.opcode, OpCode.BinaryFrame); assertEquals(bin.isLastFrame, true); assertEquals(bin.mask, undefined); - assertEquals(bin.payload.length, 0xffff + 1); + assertEquals(bin.payload.length, payloadLength); }); test(async function wsCreateSecAccept(): Promise { -- cgit v1.2.3