1
I have a function that returns an object with two properties: name and id, where name will receive its value per parameter and id is generated automatically by Date.now()
.
My goal is to create a test in Jest that checks if the id value is of the numeric type, since I can’t compare its exact value
The object creation function:
const createNewTodo = (addTodoInputValue) => {
const newTodo = {
id: Date.now(),
name: addTodoInputValue
}
return newTodo
}
Maybe I can be useful: How to apply mock in "new date()" using Jest?
– Luiz Felipe