From e06a1f4ac34359cd3c56ff968150c3ce4e0d0f96 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 27 Aug 2024 13:47:47 +0200 Subject: [PATCH] tried to solve issue with PUT tests --- test/todos.test.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/todos.test.js b/test/todos.test.js index 61bae61..f789a95 100644 --- a/test/todos.test.js +++ b/test/todos.test.js @@ -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); @@ -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);