Skip to content

Commit

Permalink
Add config file to DB tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenna committed Jan 23, 2017
1 parent 40e0287 commit c5e4ba5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions server/tests/seed/chatSeed.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('../../config/config');
const { Chat } = require('../../db/model/chat');
const { ObjectId } = require('mongodb');

Expand Down
1 change: 1 addition & 0 deletions server/tests/seed/userSeed.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('../../config/config');
const { User } = require('../../db/model/user');

const user1 = {
Expand Down
14 changes: 7 additions & 7 deletions server/tests/web/authenticate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('authenticate', () => {

it('should check token cookie', (done) => {
request(app)
.get('/views')
.get('/views/chatRoom')
.set('Cookie', `token=${token}`)
.end((err) => {
expect(findUserSpy).toHaveBeenCalled();
Expand All @@ -34,8 +34,8 @@ describe('authenticate', () => {
findUserSpy.reset();

request(app)
.get('/views')
.expect(401)
.get('/views/chatRoom')
.expect(303)
.expect('x-authorization', 'No token cookie')
.expect('location', '/views/login')
.end((err) => {
Expand All @@ -48,9 +48,9 @@ describe('authenticate', () => {
findUserSpy.andReturn(new Promise(resolve => resolve()));

request(app)
.get('/views')
.get('/views/chatRoom')
.set('Cookie', `token=${token}`)
.expect(401)
.expect(303)
.expect('x-authorization', 'No user found')
.expect('location', '/views/login')
.end((err) => {
Expand All @@ -66,9 +66,9 @@ describe('authenticate', () => {
}));

request(app)
.get('/views')
.get('/views/chatRoom')
.set('Cookie', `token=${token}`)
.expect(401)
.expect(303)
.expect('x-authorization', 'Token expired')
.expect('location', '/views/login')
.end((err) => {
Expand Down

0 comments on commit c5e4ba5

Please sign in to comment.