summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshish Kaila <ashishkaila@hotmail.com>2017-10-18 13:59:48 -0700
committerGibson Fahnestock <gibfahn@gmail.com>2017-10-31 00:15:13 +0000
commit55ba1d41159dccbcb850073499bb21d845462c4e (patch)
treea2a38a4633451b07957aa4d80f4deb31215854b9
parenta6b3cd8166d6d8362f3e0b4fc0d1dc180c8aa13c (diff)
downloadnode-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.js11
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'
+ });
+});