Skip to content

Commit

Permalink
Revert "Use path.join to run tests on windows (#105)"
Browse files Browse the repository at this point in the history
This reverts commit d2b4e1f.
  • Loading branch information
cemremengu authored and mcollina committed Sep 28, 2018
1 parent c276867 commit 8f3018e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
21 changes: 9 additions & 12 deletions tap-snapshots/test-static.js-TAP.test.js
Expand Up @@ -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": {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down
9 changes: 4 additions & 5 deletions test/route.js
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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')
})
})
Expand All @@ -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')
})
})
Expand Down Expand Up @@ -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')
})
})
Expand All @@ -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')
})
})
Expand Down

0 comments on commit 8f3018e

Please sign in to comment.