@globocom/backstage-functions-sandbox
Advanced tools
Comparing version 0.3.3 to 0.4.0
function emitError(response, statusCode, error) { | ||
response.status(statusCode).send({ error }); | ||
const err = new Error(error); | ||
err.statusCode = statusCode; | ||
response.callback(err); | ||
} | ||
@@ -4,0 +6,0 @@ |
{ | ||
"name": "@globocom/backstage-functions-sandbox", | ||
"version": "0.3.3", | ||
"version": "0.4.0", | ||
"description": "Sandbox for Backstage functions", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -68,7 +68,7 @@ const expect = require('chai').expect; | ||
let res; | ||
let codeResponse; | ||
let error; | ||
before((done) => { | ||
const callback = (err, responseData) => { | ||
codeResponse = responseData; | ||
const callback = (err) => { | ||
error = err; | ||
done(); | ||
@@ -81,4 +81,4 @@ }; | ||
it('should sends the response with status of 304', () => { | ||
expect(codeResponse.body).to.be.eql({ error: 'Its an error' }); | ||
expect(codeResponse.status).to.be.eql(400); | ||
expect(error.message).to.be.eql('Its an error'); | ||
expect(error.statusCode).to.be.eql(400); | ||
}); | ||
@@ -89,7 +89,7 @@ }); | ||
let res; | ||
let codeResponse; | ||
let error; | ||
before((done) => { | ||
const callback = (err, responseData) => { | ||
codeResponse = responseData; | ||
const callback = (err) => { | ||
error = err; | ||
done(); | ||
@@ -102,4 +102,4 @@ }; | ||
it('should sends the response with status of 404', () => { | ||
expect(codeResponse.body).to.be.eql({ error: 'My resource not is found' }); | ||
expect(codeResponse.status).to.be.eql(404); | ||
expect(error.message).to.be.eql('My resource not is found'); | ||
expect(error.statusCode).to.be.eql(404); | ||
}); | ||
@@ -110,7 +110,7 @@ }); | ||
let res; | ||
let codeResponse; | ||
let error; | ||
before((done) => { | ||
const callback = (err, responseData) => { | ||
codeResponse = responseData; | ||
const callback = (err) => { | ||
error = err; | ||
done(); | ||
@@ -123,4 +123,4 @@ }; | ||
it('should sends the response with status of 422', () => { | ||
expect(codeResponse.body).to.be.eql({ error: 'Field a is wrong' }); | ||
expect(codeResponse.status).to.be.eql(422); | ||
expect(error.message).to.be.eql('Field a is wrong'); | ||
expect(error.statusCode).to.be.eql(422); | ||
}); | ||
@@ -131,7 +131,7 @@ }); | ||
let res; | ||
let codeResponse; | ||
let error; | ||
before((done) => { | ||
const callback = (err, responseData) => { | ||
codeResponse = responseData; | ||
const callback = (err) => { | ||
error = err; | ||
done(); | ||
@@ -144,4 +144,4 @@ }; | ||
it('should sends the response with status of 500', () => { | ||
expect(codeResponse.body).to.be.eql({ error: 'Server crashed' }); | ||
expect(codeResponse.status).to.be.eql(500); | ||
expect(error.message).to.be.eql('Server crashed'); | ||
expect(error.statusCode).to.be.eql(500); | ||
}); | ||
@@ -148,0 +148,0 @@ }); |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
45288
30
1115
0