Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup: add a counter for passed tests
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
  • Loading branch information
daeyeon committed Jul 21, 2022
commit 958ee56bc25d2028b4439c8a50a07f8ef055c9e6
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
const common = require('../common');
const assert = require('node:assert');

let pass = 0;

{
// ReadableStream with byte source: respondWithNewView() throws if the
// supplied view's buffer has a different length (in the closed state)
Expand All @@ -12,9 +14,11 @@ const assert = require('node:assert');

c.close();

assert.throws(() => {
c.byobRequest.respondWithNewView(view);
}, RangeError);
assert.throws(() => c.byobRequest.respondWithNewView(view), {
code: 'ERR_INVALID_ARG_VALUE',
name: 'RangeError',
});
pass++;
}),
type: 'bytes',
});
Expand All @@ -34,13 +38,17 @@ const assert = require('node:assert');
const view = new Uint8Array([1, 2, 3]);
reader.read(view);

assert.throws(() => {
c.byobRequest.respondWithNewView(view);
}, TypeError);
assert.throws(() => c.byobRequest.respondWithNewView(view), {
code: 'ERR_INVALID_STATE',
name: 'TypeError',
});
pass++;
}),
type: 'bytes',
});

const reader = stream.getReader({ mode: 'byob' });
reader.read(new Uint8Array([4, 5, 6]));
}

process.on('exit', () => assert.strictEqual(pass, 2));