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');
|
const resetDatabase = require('test/helpers/resetDatabase');
|
||||||
|
|
||||||
describe('As a user I want to log in', () => {
|
describe('As a user I want to log in', () => {
|
||||||
before(() => resetDatabase());
|
before(() => {
|
||||||
before(() => createUser('test_user', 'test@gmail.com', 'password'));
|
return resetDatabase()
|
||||||
|
.then(() => createUser('test_user', 'password'))
|
||||||
|
})
|
||||||
|
|
||||||
it('should return 200 with a token if correct credentials are given', () =>
|
it('should return 200 with a token if correct credentials are given', () =>
|
||||||
request(app)
|
request(app)
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ const createUser = require('test/helpers/createUser');
|
|||||||
const createToken = require('test/helpers/createToken');
|
const createToken = require('test/helpers/createToken');
|
||||||
|
|
||||||
describe('As a user I want to request a movie', () => {
|
describe('As a user I want to request a movie', () => {
|
||||||
before(() => resetDatabase());
|
before(() => {
|
||||||
before(() => createUser('test_user', 'test@gmail.com', 'password'));
|
return resetDatabase()
|
||||||
|
.then(() => createUser('test_user', 'test@gmail.com', 'password'));
|
||||||
|
})
|
||||||
|
|
||||||
it('should return 200 when item is requested', () =>
|
it('should return 200 when item is requested', () =>
|
||||||
request(app)
|
request(app)
|
||||||
|
|||||||
Reference in New Issue
Block a user