From 8f3018eff786034d3686ec89251d7b9fbd1bcf5d Mon Sep 17 00:00:00 2001 From: Cemre Mengu Date: Thu, 27 Sep 2018 11:45:32 +0300 Subject: [PATCH] Revert "Use path.join to run tests on windows (#105)" This reverts commit d2b4e1f9d48b20239e1047120b7484e081fa7a51. --- tap-snapshots/test-static.js-TAP.test.js | 21 +++++++++------------ test/route.js | 9 ++++----- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/tap-snapshots/test-static.js-TAP.test.js b/tap-snapshots/test-static.js-TAP.test.js index 380d6178..97ffac11 100644 --- a/tap-snapshots/test-static.js-TAP.test.js +++ b/tap-snapshots/test-static.js-TAP.test.js @@ -5,34 +5,31 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' - -const path = require('path').join - -exports[`${path('test', 'static.js')} TAP specification validation check works > undefined 1`] = ` +exports[`test/static.js TAP specification validation check works > undefined 1`] = ` Error: specification is missing in the module options ` -exports[`${path('test', 'static.js')} TAP specification validation check works > undefined 2`] = ` +exports[`test/static.js TAP specification validation check works > undefined 2`] = ` Error: specification is not an object ` -exports[`${path('test', 'static.js')} TAP specification validation check works > undefined 3`] = ` +exports[`test/static.js TAP specification validation check works > undefined 3`] = ` Error: both specification.path and specification.document are missing, should be path to the file or swagger document spec ` -exports[`${path('test', 'static.js')} TAP specification validation check works > undefined 4`] = ` +exports[`test/static.js TAP specification validation check works > undefined 4`] = ` Error: specification.path is not a string ` -exports[`${path('test', 'static.js')} TAP specification validation check works > undefined 5`] = ` +exports[`test/static.js TAP specification validation check works > undefined 5`] = ` Error: /hello/lionel.richie does not exist ` -exports[`${path('test', 'static.js')} TAP specification validation check works > undefined 6`] = ` +exports[`test/static.js TAP specification validation check works > undefined 6`] = ` Error: specification.postProcessor should be a function ` -exports[`${path('test', 'static.js')} TAP swagger route returns json > undefined 1`] = ` +exports[`test/static.js TAP swagger route returns json > undefined 1`] = ` { "openapi": "3.0.0", "info": { @@ -86,7 +83,7 @@ exports[`${path('test', 'static.js')} TAP swagger route returns json > undefined } ` -exports[`${path('test', 'static.js')} TAP postProcessor works, swagger route returns updated yaml > undefined 1`] = ` +exports[`test/static.js TAP postProcessor works, swagger route returns updated yaml > undefined 1`] = ` openapi: 3.0.0 info: description: Test swagger specification @@ -121,7 +118,7 @@ paths: ` -exports[`${path('test', 'static.js')} TAP swagger route returns explicitly passed doc > undefined 1`] = ` +exports[`test/static.js TAP swagger route returns explicitly passed doc > undefined 1`] = ` { "info": { "title": "Test swagger", diff --git a/test/route.js b/test/route.js index d7ecd61e..bc640ebe 100644 --- a/test/route.js +++ b/test/route.js @@ -8,7 +8,6 @@ const yaml = require('js-yaml') const fastifySwagger = require('../index') const resolve = require('path').resolve -const path = require('path').join const readFileSync = require('fs').readFileSync const swaggerInfo = { @@ -184,7 +183,7 @@ test('/documentation should redirect to /documentation/index.html', t => { }, (err, res) => { t.error(err) t.strictEqual(res.statusCode, 302) - t.strictEqual(res.headers['location'], `${path('/', 'documentation', 'index.html')}`) + t.strictEqual(res.headers['location'], '/documentation/index.html') t.is(typeof res.payload, 'string') }) }) @@ -209,7 +208,7 @@ test('/v1/documentation should redirect to /v1/documentation/index.html', t => { }, (err, res) => { t.error(err) t.strictEqual(res.statusCode, 302) - t.strictEqual(res.headers['location'], `${path('/', 'v1', 'documentation', 'index.html')}`) + t.strictEqual(res.headers['location'], '/v1/documentation/index.html') t.is(typeof res.payload, 'string') }) }) @@ -239,7 +238,7 @@ test('/v1/foobar should redirect to /v1/foobar/index.html - in plugin', t => { }, (err, res) => { t.error(err) t.strictEqual(res.statusCode, 302) - t.strictEqual(res.headers['location'], `${path('/', 'v1', 'foobar', 'index.html')}`) + t.strictEqual(res.headers['location'], '/v1/foobar/index.html') t.is(typeof res.payload, 'string') }) }) @@ -260,7 +259,7 @@ test('with routePrefix: \'/\' should redirect to /index.html', t => { }, (err, res) => { t.error(err) t.strictEqual(res.statusCode, 302) - t.strictEqual(res.headers['location'], `${path('/', 'index.html')}`) + t.strictEqual(res.headers['location'], '/index.html') t.is(typeof res.payload, 'string') }) })