Stricter when running test, now we wait until resetdatabase and createuser are done in in the before function before running the tests.
This commit is contained in:
@@ -5,8 +5,10 @@ const createUser = require('test/helpers/createUser');
|
||||
const resetDatabase = require('test/helpers/resetDatabase');
|
||||
|
||||
describe('As a user I want to log in', () => {
|
||||
before(() => resetDatabase());
|
||||
before(() => createUser('test_user', 'test@gmail.com', 'password'));
|
||||
before(() => {
|
||||
return resetDatabase()
|
||||
.then(() => createUser('test_user', 'password'))
|
||||
})
|
||||
|
||||
it('should return 200 with a token if correct credentials are given', () =>
|
||||
request(app)
|
||||
|
||||
@@ -5,8 +5,10 @@ const createUser = require('test/helpers/createUser');
|
||||
const createToken = require('test/helpers/createToken');
|
||||
|
||||
describe('As a user I want to request a movie', () => {
|
||||
before(() => resetDatabase());
|
||||
before(() => createUser('test_user', 'test@gmail.com', 'password'));
|
||||
before(() => {
|
||||
return resetDatabase()
|
||||
.then(() => createUser('test_user', 'test@gmail.com', 'password'));
|
||||
})
|
||||
|
||||
it('should return 200 when item is requested', () =>
|
||||
request(app)
|
||||
|
||||
Reference in New Issue
Block a user