Comparing version 1.0.3 to 1.0.4
@@ -336,7 +336,7 @@ 'use strict'; | ||
} | ||
}).then(function (response) { | ||
}).then(function (data) { | ||
if (saveFixtures) { | ||
saveFixture(fileName, response, responseIsJson); | ||
saveFixture(fileName, data, responseIsJson); | ||
} | ||
serveResponse(res, _extends({}, options, { newResponse: true })); | ||
serveResponse(res, _extends({}, options, { data: data, newResponse: true })); | ||
}).catch(function (err) { | ||
@@ -343,0 +343,0 @@ console.error('==> ⛔️ ' + err); |
{ | ||
"name": "highwind", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Mock API express server", | ||
@@ -5,0 +5,0 @@ "main": "lib/mock_api.js", |
@@ -73,3 +73,2 @@ import 'babel-polyfill'; | ||
describe('When the request method is GET', function() { | ||
describe('And the saveFixtures setting is set to true', function() { | ||
@@ -104,3 +103,7 @@ beforeEach(function(done) { | ||
.expect('Content-Type', /application\/json/) | ||
.expect(200, response, () => fs.access(responsePath, fs.F_OK, done)); | ||
.expect(200) | ||
.end((err, res) => { | ||
expect(res.text).to.equal(JSON.stringify(response)); | ||
fs.access(responsePath, fs.F_OK, done); | ||
}); | ||
}); | ||
@@ -112,3 +115,7 @@ | ||
.expect('Content-Type', /application\/json/) | ||
.expect(200, response, () => fs.access(responsePath, fs.F_OK, done)); | ||
.expect(200) | ||
.end((err, res) => { | ||
expect(res.text).to.equal(JSON.stringify(response)); | ||
fs.access(responsePath, fs.F_OK, done); | ||
}); | ||
}); | ||
@@ -120,3 +127,7 @@ | ||
.expect('Content-Type', /application\/javascript/) | ||
.expect(200, response, () => fs.access(responsePathWithCallback, fs.F_OK, done)); | ||
.expect(200) | ||
.end((err, res) => { | ||
expect(res.text).to.equal(JSON.stringify(response)); | ||
fs.access(responsePathWithCallback, fs.F_OK, done); | ||
}); | ||
}); | ||
@@ -146,7 +157,14 @@ }); | ||
.expect('Content-Type', /application\/json/) | ||
.expect(200, response, () => fs.access(responsePath, fs.F_OK, (err) => { | ||
if (err) { | ||
done(); | ||
} | ||
})); | ||
.expect(200) | ||
.end((err, res) => { | ||
expect(res.text).to.equal(JSON.stringify(response)); | ||
fs.access(responsePath, fs.F_OK, (err) => { | ||
if (err) { | ||
return done(); | ||
} | ||
throw new Error( | ||
'Saved a fixture with saveFixtures set to false' | ||
); | ||
}); | ||
}); | ||
}); | ||
@@ -153,0 +171,0 @@ }); |
@@ -249,7 +249,7 @@ import 'babel-polyfill'; | ||
}) | ||
.then(response => { | ||
.then(data => { | ||
if (saveFixtures) { | ||
saveFixture(fileName, response, responseIsJson); | ||
saveFixture(fileName, data, responseIsJson); | ||
} | ||
serveResponse(res, { ...options, newResponse: true }); | ||
serveResponse(res, { ...options, data, newResponse: true }); | ||
}) | ||
@@ -256,0 +256,0 @@ .catch(err => { |
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
48169
1124