Skip to content

Commit

Permalink
util: expand test coverage for util.deprecate
Browse files Browse the repository at this point in the history
Test for invalid argument types passed to code on util.deprecate.

PR-URL: #16305
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>
  • Loading branch information
akaila authored and apapirovski committed Oct 22, 2017
1 parent cfea677 commit fe8297c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/parallel/test-util-deprecate-invalid-code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

const common = require('../common');
const util = require('util');

[1, true, false, null, {}].forEach((notString) => {
common.expectsError(() => util.deprecate(() => {}, 'message', notString), {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
message: 'The "code" argument must be of type string'
});
});

0 comments on commit fe8297c

Please sign in to comment.