-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: refactor and fix test-crypto #9807
Conversation
|
||
var fs = require('fs'); | ||
crypto.DEFAULT_ENCODING = 'buffer'; | ||
|
||
// Test Certificates | ||
var caPem = fs.readFileSync(common.fixturesDir + '/test_ca.pem', 'ascii'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this, and some other variables, be changed to const
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
assert.equal(-1, crypto.getCiphers().indexOf('AES-128-CBC')); | ||
assert.notStrictEqual(0, crypto.getCiphers().length); | ||
assert(crypto.getCiphers().includes('aes-128-cbc')); | ||
assert(!crypto.getCiphers().includes('AES-128-CBC')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if these are easier to read if written like this:
assert.strictEqual(crypto.getCiphers().includes('AES-128-CBC'), false);
* var -> const. * Group and sort imports. * Replace use of the deprecated crypto.createCredentials. * Fix incorrect use of string instead of RegExp in `throws` assertions. * Clone array with `.slice()` and remove dependency on util. * assert.notEqual -> assert.notStrictEqual. * indexOf -> includes.
fcca387
to
9828087
Compare
Updated. I made some RegExps stricter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Unrelated CI failure. Landed in ae029f5. |
* var -> const. * Group and sort imports. * Replace use of the deprecated crypto.createCredentials. * Fix incorrect use of string instead of RegExp in `throws` assertions. * Clone array with `.slice()` and remove dependency on util. * assert.notEqual -> assert.notStrictEqual. * indexOf -> includes. PR-URL: #9807 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* var -> const. * Group and sort imports. * Replace use of the deprecated crypto.createCredentials. * Fix incorrect use of string instead of RegExp in `throws` assertions. * Clone array with `.slice()` and remove dependency on util. * assert.notEqual -> assert.notStrictEqual. * indexOf -> includes. PR-URL: #9807 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* var -> const. * Group and sort imports. * Replace use of the deprecated crypto.createCredentials. * Fix incorrect use of string instead of RegExp in `throws` assertions. * Clone array with `.slice()` and remove dependency on util. * assert.notEqual -> assert.notStrictEqual. * indexOf -> includes. PR-URL: #9807 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* var -> const. * Group and sort imports. * Replace use of the deprecated crypto.createCredentials. * Fix incorrect use of string instead of RegExp in `throws` assertions. * Clone array with `.slice()` and remove dependency on util. * assert.notEqual -> assert.notStrictEqual. * indexOf -> includes. PR-URL: #9807 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* var -> const. * Group and sort imports. * Replace use of the deprecated crypto.createCredentials. * Fix incorrect use of string instead of RegExp in `throws` assertions. * Clone array with `.slice()` and remove dependency on util. * assert.notEqual -> assert.notStrictEqual. * indexOf -> includes. PR-URL: #9807 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
test, crypto
Description of change
throws
assertions..slice()
and remove dependency on util.