Skip to content

Commit

Permalink
test: add regex for expected error message
Browse files Browse the repository at this point in the history
Provide a regex to validate the error message.

PR-URL: nodejs/node#12011
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
  • Loading branch information
jfmercer authored and andrew749 committed Jul 19, 2017
1 parent 9c7840a commit 58e4b60
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/parallel/test-tls-key-mismatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ if (!common.hasCrypto) {
const assert = require('assert');
const tls = require('tls');
const fs = require('fs');
const errorMessageRegex = new RegExp('^Error: error:0B080074:x509 ' +
'certificate routines:X509_check_private_key:key values mismatch$');

const options = {
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
Expand All @@ -16,4 +18,4 @@ const options = {

assert.throws(function() {
tls.createSecureContext(options);
});
}, errorMessageRegex);

0 comments on commit 58e4b60

Please sign in to comment.