mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
tests(api): Add async to every it, before and beforeEach in v2 tests
This commit is contained in:
@@ -6,14 +6,14 @@ import {
|
||||
describe('GET /user/tasks/:id', () => {
|
||||
let user, task;
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach(async () => {
|
||||
return generateUser().then((_user) => {
|
||||
user = _user;
|
||||
task = user.todos[0];
|
||||
});
|
||||
});
|
||||
|
||||
it('gets a task', () => {
|
||||
it('gets a task', async () => {
|
||||
return user.get(`/user/tasks/${task.id}`).then((foundTask) => {
|
||||
expect(foundTask.id).to.eql(task.id);
|
||||
expect(foundTask.text).to.eql(task.text);
|
||||
@@ -23,7 +23,7 @@ describe('GET /user/tasks/:id', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error if the task does not exist', () => {
|
||||
it('returns an error if the task does not exist', async () => {
|
||||
return expect(user.get('/user/tasks/task-that-does-not-exist'))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 404,
|
||||
@@ -31,7 +31,7 @@ describe('GET /user/tasks/:id', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('does not get another user\'s task', () => {
|
||||
it('does not get another user\'s task', async () => {
|
||||
return expect(generateUser().then((otherUser) => {
|
||||
let otherUsersTask = otherUser.todos[0];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user