Skip to content

Commit 9c72921

Browse files
seppevsitaloacasas
authored andcommitted
test: improve crypto.setEngine coverage to check for errors
PR-URL: #11143 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 71f8a23 commit 9c72921

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/parallel/test-crypto-engine.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
const common = require('../common');
3+
4+
if (!common.hasCrypto) {
5+
common.skip('missing crypto');
6+
return;
7+
}
8+
9+
const assert = require('assert');
10+
const crypto = require('crypto');
11+
12+
assert.throws(function() {
13+
crypto.setEngine(true);
14+
}, /^TypeError: "id" argument should be a string$/);
15+
16+
assert.throws(function() {
17+
crypto.setEngine('/path/to/engine', 'notANumber');
18+
}, /^TypeError: "flags" argument should be a number, if present$/);

0 commit comments

Comments
 (0)