summaryrefslogtreecommitdiff
path: root/test/parallel/test-dgram-sendto.js
diff options
context:
space:
mode:
authorMithun Sasidharan <mithunsasidharan89@gmail.com>2017-12-06 20:02:42 +0530
committerAnatoli Papirovski <apapirovski@mac.com>2017-12-08 13:34:54 -0500
commit20a8e83e44a6555a40c9d5f367a9a7be8fed0374 (patch)
tree9f85630e36dd769e46cf148ebc06697045362641 /test/parallel/test-dgram-sendto.js
parentf81bb7b527bb58ee68ddd26c9eee56a133547c01 (diff)
downloadandroid-node-v8-20a8e83e44a6555a40c9d5f367a9a7be8fed0374.tar.gz
android-node-v8-20a8e83e44a6555a40c9d5f367a9a7be8fed0374.tar.bz2
android-node-v8-20a8e83e44a6555a40c9d5f367a9a7be8fed0374.zip
test: replace assert.throws w/ common.expectsError
PR-URL: https://github.com/nodejs/node/pull/17494 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'test/parallel/test-dgram-sendto.js')
-rw-r--r--test/parallel/test-dgram-sendto.js31
1 files changed, 15 insertions, 16 deletions
diff --git a/test/parallel/test-dgram-sendto.js b/test/parallel/test-dgram-sendto.js
index c922dc1039..782b2f692b 100644
--- a/test/parallel/test-dgram-sendto.js
+++ b/test/parallel/test-dgram-sendto.js
@@ -1,48 +1,47 @@
'use strict';
const common = require('../common');
-const assert = require('assert');
const dgram = require('dgram');
const socket = dgram.createSocket('udp4');
const errorMessageOffset =
/^The "offset" argument must be of type number$/;
-assert.throws(() => {
+common.expectsError(() => {
socket.sendto();
-}, common.expectsError({
+}, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: errorMessageOffset
-}));
+});
-assert.throws(() => {
+common.expectsError(() => {
socket.sendto('buffer', 1, 'offset', 'port', 'address', 'cb');
-}, common.expectsError({
+}, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: /^The "length" argument must be of type number$/
-}));
+});
-assert.throws(() => {
+common.expectsError(() => {
socket.sendto('buffer', 'offset', 1, 'port', 'address', 'cb');
-}, common.expectsError({
+}, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: errorMessageOffset
-}));
+});
-assert.throws(() => {
+common.expectsError(() => {
socket.sendto('buffer', 1, 1, 10, false, 'cb');
-}, common.expectsError({
+}, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: /^The "address" argument must be of type string$/
-}));
+});
-assert.throws(() => {
+common.expectsError(() => {
socket.sendto('buffer', 1, 1, false, 'address', 'cb');
-}, common.expectsError({
+}, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: /^The "port" argument must be of type number$/
-}));
+});