Skip to content
This repository has been archived by the owner on Feb 4, 2020. It is now read-only.

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pknoth committed Jun 21, 2018
1 parent d3c40a4 commit 18cbb55
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions auth/test/db-token.service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,7 @@ describe('Db Token service', () => {

it('gets a token when the token exists', () => {
const encryptedToken = crypto.createHash('sha512').update('test-token').digest('hex')
const req = {
get: function (key) {
const res = {
'X-API-Key': 'test-token'
}
return res[key]
}
}
return service.getConsumer(req).then((token) => {
return service.getConsumer({ token: 'test-token' }).then((token) => {
expect(token).to.deep.equal({
'_id': token['_id'],
'hashed_token': encryptedToken,
Expand All @@ -41,15 +33,7 @@ describe('Db Token service', () => {
})

it('gets null when the token does not exists', () => {
const req = {
get: function (key) {
const res = {
'X-API-Key': 'bad-token'
}
return res[key]
}
}
return service.getConsumer(req).then((token) => {
return service.getConsumer({ token: 'bad-token' }).then((token) => {
expect(token).to.equal(null)
})
})
Expand Down

0 comments on commit 18cbb55

Please sign in to comment.