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('DELETE /user/tasks/:id', () => {
|
||||
let user, task;
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach(async () => {
|
||||
return generateUser().then((_user) => {
|
||||
user = _user;
|
||||
task = user.todos[0];
|
||||
});
|
||||
});
|
||||
|
||||
it('deletes a task', () => {
|
||||
it('deletes a task', async () => {
|
||||
return expect(user.del(`/user/tasks/${task.id}`)
|
||||
.then((res) => {
|
||||
return user.get(`/user/tasks/${task.id}`);
|
||||
@@ -23,7 +23,7 @@ describe('DELETE /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.del('/user/tasks/task-that-does-not-exist'))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 404,
|
||||
@@ -31,7 +31,7 @@ describe('DELETE /user/tasks/:id', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('does not delete another user\'s task', () => {
|
||||
it('does not delete another user\'s task', async () => {
|
||||
return expect(generateUser().then((otherUser) => {
|
||||
let otherUsersTask = otherUser.todos[0];
|
||||
return user.del(`/user/tasks/${otherUsersTask.id}`);
|
||||
|
||||
Reference in New Issue
Block a user