Browse Source

test: increase specificity in dgram test

Expand error message checking to include the entire error string in
test-dgram-membership.

PR-URL: https://github.com/nodejs/node/pull/11187
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
v6.x
Rich Trott 8 years ago
committed by Myles Borins
parent
commit
28111f9eb2
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 10
      test/parallel/test-dgram-membership.js

10
test/parallel/test-dgram-membership.js

@ -12,7 +12,7 @@ const setup = dgram.createSocket.bind(dgram, {type: 'udp4', reuseAddr: true});
const socket = setup();
socket.close(common.mustCall(() => {
assert.throws(() => { socket.addMembership(multicastAddress); },
/Not running/);
/^Error: Not running$/);
}));
}
@ -21,7 +21,7 @@ const setup = dgram.createSocket.bind(dgram, {type: 'udp4', reuseAddr: true});
const socket = setup();
socket.close(common.mustCall(() => {
assert.throws(() => { socket.dropMembership(multicastAddress); },
/Not running/);
/^Error: Not running$/);
}));
}
@ -29,7 +29,7 @@ const setup = dgram.createSocket.bind(dgram, {type: 'udp4', reuseAddr: true});
{
const socket = setup();
assert.throws(() => { socket.addMembership(); },
/multicast address must be specified/);
/^Error: multicast address must be specified$/);
socket.close();
}
@ -37,7 +37,7 @@ const setup = dgram.createSocket.bind(dgram, {type: 'udp4', reuseAddr: true});
{
const socket = setup();
assert.throws(() => { socket.dropMembership(); },
/multicast address must be specified/);
/^Error: multicast address must be specified$/);
socket.close();
}
@ -69,7 +69,7 @@ const setup = dgram.createSocket.bind(dgram, {type: 'udp4', reuseAddr: true});
const socket = setup();
assert.throws(
() => { socket.dropMembership(multicastAddress); },
/EADDRNOTAVAIL/
/^Error: dropMembership EADDRNOTAVAIL$/
);
socket.close();
}

Loading…
Cancel
Save