summaryrefslogtreecommitdiff
path: root/ws/test.ts
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2019-05-23 19:04:06 -0700
committerBert Belder <bertbelder@gmail.com>2019-05-29 09:50:12 -0700
commitb95f79d74cbcf3492abd95d4c90839e32f51399f (patch)
treed0c68f01c798da1e3b81930cfa58a5370c56775f /ws/test.ts
parent5b37b560fb047e1df6e6f68fcbaece922637a93c (diff)
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
Diffstat (limited to 'ws/test.ts')
-rw-r--r--ws/test.ts10
1 files changed, 6 insertions, 4 deletions
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<void> {
});
test(async function wsReadUnmaskedBigBinaryFrame(): Promise<void> {
+ 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<void> {
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<void> {
+ 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<void> {
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<void> {