test: refactor and fix test-crypto
Checklist
-
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passes -
commit message follows commit guidelines
Affected core subsystem(s)
test, crypto
Description of change
- 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.