Skip to content

Commit

Permalink
Update tests to account for the express upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed May 20, 2018
1 parent d520931 commit 642fd42
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions test/unexpectedExpress.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ describe('unexpectedExpress', function () {
'X-Powered-By: Express\n' +
'Content-Type: text/html; charset=utf-8\n' +
'Content-Length: 6\n' +
'ETag: "-1628037227"\n' +
'ETag: W/"6-iEPX+SQWIR3p67lj/0zigSWTKHg"\n' +
'Date: Sat, 12 Mar 2016 22:56:04 GMT\n' +
'Connection: keep-alive\n' +
'\n' +
Expand Down Expand Up @@ -1072,7 +1072,7 @@ describe('unexpectedExpress', function () {
'\n' +
'HTTP/1.1 200 OK\n' +
'X-Powered-By: Express\n' +
'Content-Type: application/json\n' +
'Content-Type: application/json; charset=utf-8\n' +
'ETag: "abc123" // should equal "foo456"\n' +
' //\n' +
' // -"abc123"\n' +
Expand Down Expand Up @@ -1111,7 +1111,7 @@ describe('unexpectedExpress', function () {
'\n' +
'HTTP/1.1 200 OK\n' +
'X-Powered-By: Express\n' +
'Content-Type: application/json\n' +
'Content-Type: application/json; charset=utf-8\n' +
'ETag: "abc123" // should equal "foo456"\n' +
' //\n' +
' // -"abc123"\n' +
Expand All @@ -1125,15 +1125,15 @@ describe('unexpectedExpress', function () {
});

it('should fail if the middleware calls the next function more than once', function () {
expect(function () {
expect(function (req, res, next) {
return expect(function () {
return expect(function (req, res, next) {
next();
next();
}, 'to yield exchange satisfying', {
request: {},
response: {}
});
}, 'to throw', 'next called more than once');
}, 'to error', 'next called more than once');
});

it('should fail if the middleware calls the next function, continues with the next middleware and calls next again', function () {
Expand All @@ -1146,23 +1146,23 @@ describe('unexpectedExpress', function () {
res.send('Send some data');
});

expect(function () {
expect(app, 'to yield exchange satisfying', {
return expect(function () {
return expect(app, 'to yield exchange satisfying', {
request: {},
response: {}
});
}, 'to throw', 'wat');
}, 'to error', 'wat');
});

it('should not remove the origin of uncaught exceptions from middleware', function () {
expect(function () {
expect(express().use(function (req, res, next) {
return expect(function () {
return expect(express().use(function (req, res, next) {
JSON.parse('INVALIDJSON');
}), 'to yield exchange satisfying', {
request: {},
response: {}
});
}, 'to throw', function (err) {
}, 'to error', function (err) {
expect(err.stack, 'to contain', 'test/unexpectedExpress.js');
});
});
Expand Down Expand Up @@ -1335,9 +1335,9 @@ describe('unexpectedExpress', function () {
'\n' +
'HTTP/1.1 200 OK\n' +
'X-Powered-By: Express\n' +
'Content-Type: application/json\n' +
'Content-Type: application/json; charset=utf-8\n' +
'Content-Length: 11\n' +
'ETag: "-1305345262"\n' +
'ETag: W/"b-MqXQsTMhQKye6DxXrQR7aiQcPhE"\n' +
'Date: Sat, 12 Mar 2016 22:56:04 GMT\n' +
'Connection: keep-alive\n' +
'\n' +
Expand Down

0 comments on commit 642fd42

Please sign in to comment.