Comparing version 0.13.1 to 0.13.2
@@ -21,3 +21,3 @@ 'use strict'; | ||
this.app = app; | ||
this.fixturePath = path.resolve(app.config.fixturesDir, fixtureName); | ||
this.fixturePath = path.normalize(app.config.fixturesDir + '/' + fixtureName); | ||
this.count = 0; | ||
@@ -24,0 +24,0 @@ |
@@ -5,2 +5,3 @@ 'use strict'; | ||
const _ = require('lodash'); | ||
const expandPath = require('../../lib/expandPath'); | ||
@@ -49,6 +50,6 @@ /** | ||
if (response.type) res.type(response.type); | ||
send = res.sendFile.bind(res, path.resolve(response.filePath)); | ||
send = res.sendFile.bind(res, expandPath(response.filePath)); | ||
} else if (response.fixture) { // if fixture, send fixture file | ||
if (response.type) res.type(response.type); | ||
send = res.sendFile.bind(res, path.resolve(this.app.config.fixturesDir, response.fixture)); | ||
send = res.sendFile.bind(res, path.normalize(this.app.config.fixturesDir + '/' + response.fixture)); | ||
} else if (response.html) { // if html, set Content-Type to application/html and send | ||
@@ -55,0 +56,0 @@ res.type(response.type || 'html'); |
'use strict'; | ||
const path = require('path'); | ||
const relativeRoot = require('./relativeRoot'); | ||
const expandPath = require('./expandPath'); | ||
@@ -17,5 +16,5 @@ const configDefaults = { | ||
// Expand file system configuration paths relative to configuration root | ||
config.fixturesDir = path.resolve(relativeRoot, config.fixturesDir); | ||
config.fixturesDir = expandPath(config.fixturesDir); | ||
return config; | ||
}; |
{ | ||
"name": "mockyeah", | ||
"version": "0.13.1", | ||
"version": "0.13.2", | ||
"description": "An invaluable service mocking platform built on Express.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,4 +5,4 @@ { | ||
"options": { | ||
"filePath": "./test/fixtures/some-data.json" | ||
"filePath": "./fixtures/some-data.json" | ||
} | ||
} |
@@ -10,3 +10,3 @@ 'use strict'; | ||
it('should respond with a CSV Content-Type for CSV files', (done) => { | ||
mockyeah.get('/service/exists', { filePath: './test/fixtures/some-data.csv' }); | ||
mockyeah.get('/service/exists', { filePath: './fixtures/some-data.csv' }); | ||
@@ -20,3 +20,3 @@ request | ||
it('should respond with a JSON Content-Type for JSON files', (done) => { | ||
mockyeah.get('/service/exists', { filePath: './test/fixtures/some-data.json' }); | ||
mockyeah.get('/service/exists', { filePath: './fixtures/some-data.json' }); | ||
@@ -30,3 +30,3 @@ request | ||
it('should respond with a text Content-Type for text files', (done) => { | ||
mockyeah.get('/service/exists', { filePath: './test/fixtures/some-data.txt' }); | ||
mockyeah.get('/service/exists', { filePath: './fixtures/some-data.txt' }); | ||
@@ -40,3 +40,3 @@ request | ||
it('should respond with a XML Content-Type for XML files', (done) => { | ||
mockyeah.get('/service/exists', { filePath: './test/fixtures/some-data.xml' }); | ||
mockyeah.get('/service/exists', { filePath: './fixtures/some-data.xml' }); | ||
@@ -50,3 +50,3 @@ request | ||
it('should allow Content-Type override', (done) => { | ||
mockyeah.get('/service/exists', { filePath: './test/fixtures/some-data.json', type: 'text' }); | ||
mockyeah.get('/service/exists', { filePath: './fixtures/some-data.json', type: 'text' }); | ||
@@ -53,0 +53,0 @@ request |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46059
50
996