diff options
author | Ashish Kaila <ashishkaila@hotmail.com> | 2017-10-18 13:59:48 -0700 |
---|---|---|
committer | Gibson Fahnestock <gibfahn@gmail.com> | 2017-10-31 00:15:13 +0000 |
commit | 55ba1d41159dccbcb850073499bb21d845462c4e (patch) | |
tree | a2a38a4633451b07957aa4d80f4deb31215854b9 | |
parent | a6b3cd8166d6d8362f3e0b4fc0d1dc180c8aa13c (diff) | |
download | node-new-55ba1d41159dccbcb850073499bb21d845462c4e.tar.gz |
util: expand test coverage for util.deprecate
Test for invalid argument types passed to code on util.deprecate.
PR-URL: https://github.com/nodejs/node/pull/16305
Backport-PR-URL: https://github.com/nodejs/node/pull/16430
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
-rw-r--r-- | test/parallel/test-util-deprecate-invalid-code.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/parallel/test-util-deprecate-invalid-code.js b/test/parallel/test-util-deprecate-invalid-code.js new file mode 100644 index 0000000000..c96083173c --- /dev/null +++ b/test/parallel/test-util-deprecate-invalid-code.js @@ -0,0 +1,11 @@ +'use strict'; + +const common = require('../common'); +const util = require('util'); + +[1, true, false, null, {}].forEach((notString) => { + common.expectsError(() => util.deprecate(() => {}, 'message', notString), { + type: TypeError, + message: '`code` argument must be a string' + }); +}); |