Permalink
Browse files

update tests with lowercase headers

  • Loading branch information...
jeremydaly committed Apr 24, 2018
1 parent b4caff9 commit 1d8ec09d9cbef4b1260905c473640b4c3d2624f8
Showing with 226 additions and 226 deletions.
  1. +7 −7 test/attachments.js
  2. +3 −3 test/basePath.js
  3. +34 −34 test/cookies.js
  4. +43 −43 test/download.js
  5. +5 −5 test/errorHandling.js
  6. +2 −2 test/finally.js
  7. +3 −3 test/middleware.js
  8. +4 −4 test/modules.js
  9. +2 −2 test/namespaces.js
  10. +16 −16 test/register.js
  11. +15 −15 test/responses.js
  12. +48 −48 test/routes.js
  13. +44 −44 test/sendFile.js
@@ -63,7 +63,7 @@ describe('Attachment Tests:', function() {
return new Promise((resolve,reject) => {
api.run(_event,{},function(err,res) { resolve(res) })
}).then((result) => {
expect(result).to.deep.equal({ headers: { 'Content-Disposition': 'attachment', 'Content-Type': 'application/json' }, statusCode: 200, body: '{"status":"ok"}', isBase64Encoded: false })
expect(result).to.deep.equal({ headers: { 'content-disposition': 'attachment', 'content-type': 'application/json' }, statusCode: 200, body: '{"status":"ok"}', isBase64Encoded: false })
})
}) // end it

@@ -73,7 +73,7 @@ describe('Attachment Tests:', function() {
return new Promise((resolve,reject) => {
api.run(_event,{},function(err,res) { resolve(res) })
}).then((result) => {
expect(result).to.deep.equal({ headers: { 'Content-Disposition': 'attachment; filename=\"foo.pdf\"', 'Content-Type': 'application/pdf' }, statusCode: 200, body: 'filedata', isBase64Encoded: false })
expect(result).to.deep.equal({ headers: { 'content-disposition': 'attachment; filename=\"foo.pdf\"', 'content-type': 'application/pdf' }, statusCode: 200, body: 'filedata', isBase64Encoded: false })
})
}) // end it

@@ -83,7 +83,7 @@ describe('Attachment Tests:', function() {
return new Promise((resolve,reject) => {
api.run(_event,{},function(err,res) { resolve(res) })
}).then((result) => {
expect(result).to.deep.equal({ headers: { 'Content-Disposition': 'attachment; filename=\"foo.png\"', 'Content-Type': 'image/png' }, statusCode: 200, body: 'filedata', isBase64Encoded: false })
expect(result).to.deep.equal({ headers: { 'content-disposition': 'attachment; filename=\"foo.png\"', 'content-type': 'image/png' }, statusCode: 200, body: 'filedata', isBase64Encoded: false })
})
}) // end it

@@ -93,7 +93,7 @@ describe('Attachment Tests:', function() {
return new Promise((resolve,reject) => {
api.run(_event,{},function(err,res) { resolve(res) })
}).then((result) => {
expect(result).to.deep.equal({ headers: { 'Content-Disposition': 'attachment; filename=\"foo.csv\"', 'Content-Type': 'text/csv' }, statusCode: 200, body: 'filedata', isBase64Encoded: false })
expect(result).to.deep.equal({ headers: { 'content-disposition': 'attachment; filename=\"foo.csv\"', 'content-type': 'text/csv' }, statusCode: 200, body: 'filedata', isBase64Encoded: false })
})
}) // end it

@@ -103,7 +103,7 @@ describe('Attachment Tests:', function() {
return new Promise((resolve,reject) => {
api.run(_event,{},function(err,res) { resolve(res) })
}).then((result) => {
expect(result).to.deep.equal({ headers: { 'Content-Disposition': 'attachment; filename=\"foo.test\"', 'Content-Type': 'text/test' }, statusCode: 200, body: 'filedata', isBase64Encoded: false })
expect(result).to.deep.equal({ headers: { 'content-disposition': 'attachment; filename=\"foo.test\"', 'content-type': 'text/test' }, statusCode: 200, body: 'filedata', isBase64Encoded: false })
})
}) // end it

@@ -113,7 +113,7 @@ describe('Attachment Tests:', function() {
return new Promise((resolve,reject) => {
api.run(_event,{},function(err,res) { resolve(res) })
}).then((result) => {
expect(result).to.deep.equal({ headers: { 'Content-Disposition': 'attachment', 'Content-Type': 'application/json' }, statusCode: 200, body: 'filedata', isBase64Encoded: false })
expect(result).to.deep.equal({ headers: { 'content-disposition': 'attachment', 'content-type': 'application/json' }, statusCode: 200, body: 'filedata', isBase64Encoded: false })
})
}) // end it

@@ -123,7 +123,7 @@ describe('Attachment Tests:', function() {
return new Promise((resolve,reject) => {
api.run(_event,{},function(err,res) { resolve(res) })
}).then((result) => {
expect(result).to.deep.equal({ headers: { 'Content-Disposition': 'attachment', 'Content-Type': 'application/json' }, statusCode: 200, body: 'filedata', isBase64Encoded: false })
expect(result).to.deep.equal({ headers: { 'content-disposition': 'attachment', 'content-type': 'application/json' }, statusCode: 200, body: 'filedata', isBase64Encoded: false })
})
}) // end it

@@ -47,7 +47,7 @@ describe('Base Path Tests:', function() {
return new Promise((resolve,reject) => {
api.run(_event,{},function(err,res) { resolve(res) })
}).then((result) => {
expect(result).to.deep.equal({ headers: { 'Content-Type': 'application/json' }, statusCode: 200, body: '{"method":"get","status":"ok"}', isBase64Encoded: false })
expect(result).to.deep.equal({ headers: { 'content-type': 'application/json' }, statusCode: 200, body: '{"method":"get","status":"ok"}', isBase64Encoded: false })
})
}) // end it

@@ -57,7 +57,7 @@ describe('Base Path Tests:', function() {
return new Promise((resolve,reject) => {
api.run(_event,{},function(err,res) { resolve(res) })
}).then((result) => {
expect(result).to.deep.equal({ headers: { 'Content-Type': 'application/json' }, statusCode: 200, body: '{"method":"get","status":"ok","param":"123"}', isBase64Encoded: false })
expect(result).to.deep.equal({ headers: { 'content-type': 'application/json' }, statusCode: 200, body: '{"method":"get","status":"ok","param":"123"}', isBase64Encoded: false })
})
}) // end it

@@ -68,7 +68,7 @@ describe('Base Path Tests:', function() {
api.run(_event,{},function(err,res) { resolve(res) })
}).then((result) => {
// console.log(JSON.stringify(JSON.parse(result.body),null,2));
expect(result).to.deep.equal({ headers: { 'Content-Type': 'application/json' }, statusCode: 200, body: '{"path":"/v1/test/test2/test3","method":"get","status":"ok"}', isBase64Encoded: false })
expect(result).to.deep.equal({ headers: { 'content-type': 'application/json' }, statusCode: 200, body: '{"path":"/v1/test/test2/test3","method":"get","status":"ok"}', isBase64Encoded: false })
})
}) // end it

@@ -14,7 +14,7 @@ let event = {
path: '/test',
body: {},
headers: {
'Content-Type': 'application/json'
'content-type': 'application/json'
}
}

@@ -129,8 +129,8 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'Set-Cookie': 'test=value; Path=/'
'content-type': 'application/json',
'set-cookie': 'test=value; Path=/'
}, statusCode: 200, body: '{}', isBase64Encoded: false
})
})
@@ -144,8 +144,8 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'Set-Cookie': 'test=http%3A%2F%2F%20%5B%5D%20foo%3Bbar; Path=/'
'content-type': 'application/json',
'set-cookie': 'test=http%3A%2F%2F%20%5B%5D%20foo%3Bbar; Path=/'
}, statusCode: 200, body: '{}', isBase64Encoded: false
})
})
@@ -160,8 +160,8 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'Set-Cookie': 'test=%7B%22foo%22%3A%22bar%22%7D; Path=/'
'content-type': 'application/json',
'set-cookie': 'test=%7B%22foo%22%3A%22bar%22%7D; Path=/'
}, statusCode: 200, body: '{}', isBase64Encoded: false
})
})
@@ -176,8 +176,8 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'Set-Cookie': '123=value; Path=/'
'content-type': 'application/json',
'set-cookie': '123=value; Path=/'
}, statusCode: 200, body: '{}', isBase64Encoded: false
})
})
@@ -192,8 +192,8 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'Set-Cookie': 'test=value; Expires=Tue, 01 Jan 2019 00:00:00 GMT; Path=/'
'content-type': 'application/json',
'set-cookie': 'test=value; Expires=Tue, 01 Jan 2019 00:00:00 GMT; Path=/'
}, statusCode: 200, body: '{}', isBase64Encoded: false
})
})
@@ -207,8 +207,8 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'Set-Cookie': 'test=value; MaxAge=3600; Expires='+ new Date(Date.now()+3600000).toUTCString() + '; Path=/'
'content-type': 'application/json',
'set-cookie': 'test=value; MaxAge=3600; Expires='+ new Date(Date.now()+3600000).toUTCString() + '; Path=/'
}, statusCode: 200, body: '{}', isBase64Encoded: false
})
})
@@ -222,8 +222,8 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'Set-Cookie': 'test=value; Domain=test.com; Expires=Tue, 01 Jan 2019 00:00:00 GMT; Path=/'
'content-type': 'application/json',
'set-cookie': 'test=value; Domain=test.com; Expires=Tue, 01 Jan 2019 00:00:00 GMT; Path=/'
}, statusCode: 200, body: '{}', isBase64Encoded: false
})
})
@@ -237,8 +237,8 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'Set-Cookie': 'test=value; Domain=test.com; Expires=Tue, 01 Jan 2019 00:00:00 GMT; HttpOnly; Path=/'
'content-type': 'application/json',
'set-cookie': 'test=value; Domain=test.com; Expires=Tue, 01 Jan 2019 00:00:00 GMT; HttpOnly; Path=/'
}, statusCode: 200, body: '{}', isBase64Encoded: false
})
})
@@ -252,8 +252,8 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'Set-Cookie': 'test=value; Domain=test.com; Expires=Tue, 01 Jan 2019 00:00:00 GMT; Path=/; Secure'
'content-type': 'application/json',
'set-cookie': 'test=value; Domain=test.com; Expires=Tue, 01 Jan 2019 00:00:00 GMT; Path=/; Secure'
}, statusCode: 200, body: '{}', isBase64Encoded: false
})
})
@@ -267,8 +267,8 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'Set-Cookie': 'test=value; Domain=test.com; Expires=Tue, 01 Jan 2019 00:00:00 GMT; Path=/test; Secure'
'content-type': 'application/json',
'set-cookie': 'test=value; Domain=test.com; Expires=Tue, 01 Jan 2019 00:00:00 GMT; Path=/test; Secure'
}, statusCode: 200, body: '{}', isBase64Encoded: false
})
})
@@ -282,8 +282,8 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'Set-Cookie': 'test=value; Domain=test.com; Expires=Tue, 01 Jan 2019 00:00:00 GMT; Path=/; SameSite=Strict'
'content-type': 'application/json',
'set-cookie': 'test=value; Domain=test.com; Expires=Tue, 01 Jan 2019 00:00:00 GMT; Path=/; SameSite=Strict'
}, statusCode: 200, body: '{}', isBase64Encoded: false
})
})
@@ -297,8 +297,8 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'Set-Cookie': 'test=value; Domain=test.com; Expires=Tue, 01 Jan 2019 00:00:00 GMT; Path=/; SameSite=Lax'
'content-type': 'application/json',
'set-cookie': 'test=value; Domain=test.com; Expires=Tue, 01 Jan 2019 00:00:00 GMT; Path=/; SameSite=Lax'
}, statusCode: 200, body: '{}', isBase64Encoded: false
})
})
@@ -312,8 +312,8 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'Set-Cookie': 'test=value; Domain=test.com; Expires=Tue, 01 Jan 2019 00:00:00 GMT; Path=/; SameSite=Test'
'content-type': 'application/json',
'set-cookie': 'test=value; Domain=test.com; Expires=Tue, 01 Jan 2019 00:00:00 GMT; Path=/; SameSite=Test'
}, statusCode: 200, body: '{}', isBase64Encoded: false
})
})
@@ -337,7 +337,7 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'content-type': 'application/json',
}, statusCode: 200, body: '{"cookies":{"test":"some value"}}', isBase64Encoded: false
})
})
@@ -356,7 +356,7 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'content-type': 'application/json',
}, statusCode: 200, body: '{\"cookies\":{\"test\":\"some value\",\"test2\":{\"foo\":\"bar\"}}}', isBase64Encoded: false
})
})
@@ -376,7 +376,7 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'content-type': 'application/json',
}, statusCode: 200, body: '{\"cookies\":{\"test\":\"some value\",\"test2\":{\"foo\":\"bar\"},\"test3\":\"domain\"}}', isBase64Encoded: false
})
})
@@ -396,8 +396,8 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'Set-Cookie': 'test=; Expires=Thu, 01 Jan 1970 00:00:00 GMT; MaxAge=-1; Path=/'
'content-type': 'application/json',
'set-cookie': 'test=; Expires=Thu, 01 Jan 1970 00:00:00 GMT; MaxAge=-1; Path=/'
}, statusCode: 200, body: '{}', isBase64Encoded: false
})
})
@@ -413,8 +413,8 @@ describe('Cookie Tests:', function() {
}).then((result) => {
expect(result).to.deep.equal({
headers: {
'Content-Type': 'application/json',
'Set-Cookie': 'test=; Domain=test.com; Expires=Thu, 01 Jan 1970 00:00:00 GMT; HttpOnly; MaxAge=-1; Path=/; Secure'
'content-type': 'application/json',
'set-cookie': 'test=; Domain=test.com; Expires=Thu, 01 Jan 1970 00:00:00 GMT; HttpOnly; MaxAge=-1; Path=/; Secure'
}, statusCode: 200, body: '{}', isBase64Encoded: false
})
})
Oops, something went wrong.

0 comments on commit 1d8ec09

Please sign in to comment.