Skip to content
Closed
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
test: add Node.js TypeError test for number type buffer parameter
  • Loading branch information
markarranz committed Nov 7, 2018
commit 97f33f32df9440e52383253fcece0f94539773e5
9 changes: 9 additions & 0 deletions test/parallel/test-dgram-send-bad-arguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ assert.throws(() => { sock.send(buf, 1, 1, 65536, host); }, RangeError);

// send(buf, port, host)
assert.throws(() => { sock.send(23, 12345, host); }, TypeError);
common.expectsError(
() => { sock.send(23, 12345, host); },
{
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: 'The "buffer" argument must be one of type ' +
'Buffer, Uint8Array, or string. Received type number'
}
);

// send([buf1, ..], port, host)
assert.throws(() => { sock.send([buf, 23], 12345, host); }, TypeError);