From 86d803b3855ef8cf3b14510f484fdbdb17872533 Mon Sep 17 00:00:00 2001 From: ashleyraymaceli Date: Fri, 6 Oct 2017 10:33:46 -0700 Subject: [PATCH] test: replace common.fixturesDir with readKey PR-URL: https://github.com/nodejs/node/pull/15946 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Joyee Cheung --- test/parallel/test-http2-https-fallback.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-http2-https-fallback.js b/test/parallel/test-http2-https-fallback.js index 266c6f89f34591..4dabe4e69db780 100644 --- a/test/parallel/test-http2-https-fallback.js +++ b/test/parallel/test-http2-https-fallback.js @@ -1,13 +1,12 @@ 'use strict'; const common = require('../common'); +const fixtures = require('../common/fixtures'); if (!common.hasCrypto) common.skip('missing crypto'); const { strictEqual } = require('assert'); -const { join } = require('path'); -const { readFileSync } = require('fs'); const { createSecureContext } = require('tls'); const { createSecureServer, connect } = require('http2'); const { get } = require('https'); @@ -16,13 +15,9 @@ const { connect: tls } = require('tls'); const countdown = (count, done) => () => --count === 0 && done(); -function loadKey(keyname) { - return readFileSync(join(common.fixturesDir, 'keys', keyname)); -} - -const key = loadKey('agent8-key.pem'); -const cert = loadKey('agent8-cert.pem'); -const ca = loadKey('fake-startcom-root-cert.pem'); +const key = fixtures.readKey('agent8-key.pem'); +const cert = fixtures.readKey('agent8-cert.pem'); +const ca = fixtures.readKey('fake-startcom-root-cert.pem'); const clientOptions = { secureContext: createSecureContext({ ca }) };