-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: replace assert.throws w/ common.expectsError
PR-URL: #17494 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
- Loading branch information
1 parent
af8e27d
commit c2ff36e
Showing
10 changed files
with
85 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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$/ | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters