Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions test/parallel/test-tls-multi-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: would you mind moving this after the common.hasCrypto check?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not at all! Done!

if (!common.hasCrypto)
common.skip('missing crypto');

Expand All @@ -30,12 +31,12 @@ const fs = require('fs');

const options = {
key: [
fs.readFileSync(`${common.fixturesDir}/keys/ec-key.pem`),
fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
fs.readFileSync(fixtures.path('/keys/ec-key.pem')),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be using method fixtures.readKey to get the keys.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make a difference that fs.readFileSync() is platform specific (though only if the path is a directory I see...so not an issue). I've always been taught to keep it as simple as possible...so I assumed using path.join() is just a bit clearer? But live and learn! :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The readFileSync(fixtures(keys...)) pattern is so common in the tests that the fixtures.readKey wrapper was created to handle it. Take a look at fixtures.readKey()!

Something like fixtures.readKey('ec-key.pem').

fs.readFileSync(fixtures.path('/keys/agent1-key.pem')),
],
cert: [
fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`),
fs.readFileSync(`${common.fixturesDir}/keys/ec-cert.pem`)
fs.readFileSync(fixtures.path('/keys/agent1-cert.pem')),
fs.readFileSync(fixtures.path('/keys/ec-cert.pem')),
]
};

Expand Down