Closed zamarrowski closed 3 years ago
export const editTodo = (todos, value, id) => { return todos.map(todo => { if (todo.id === id) todo.title = value return todo }) }
import { editTodo } from "./helpers" test('Should edit a todo', () => { const todos = [{ id: 1, title: 'hola' }] const newMessage = 'editado!' const newTodos = editTodo(todos, newMessage, todos[0].id) expect(newTodos[0].title).toBe(newMessage) })