Skip to content

Commit

Permalink
tried to solve issue with PUT tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory567 committed Aug 27, 2024
1 parent ac79128 commit e06a1f4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/todos.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ describe('Todos API', () => {
});

test('PUT /todos/:id/done should mark a todo as done', async () => {
const todo = { id: 1, name: 'Initial Task 1', done: true };
const todo = { id: 1, name: 'Initial Task 1', done: false };
db.models.todo.findByPk.mockResolvedValueOnce(todo);
todo.done = true;
const res = await request(app)
.put('/todos/1/done');
expect(res.statusCode).toEqual(200);
Expand All @@ -80,8 +81,9 @@ describe('Todos API', () => {
});

test('DELETE /todos/:id/done should mark a todo as not done', async () => {
const todo = { id: 1, name: 'Initial Task 1', done: false };
const todo = { id: 1, name: 'Initial Task 1', done: true };
db.models.todo.findByPk.mockResolvedValueOnce(todo);
todo.done = false;
const res = await request(app)
.delete('/todos/1/done');
expect(res.statusCode).toEqual(200);
Expand Down

0 comments on commit e06a1f4

Please sign in to comment.