1
0
mirror of https://github.com/morris/vanilla-todo.git synced 2025-08-22 05:33:06 +02:00

combine unit and e2e coverage, simplify test scripts

This commit is contained in:
Morris Brodersen
2024-01-29 23:52:14 +01:00
parent 9991ec23b1
commit dd29d07d31
6 changed files with 81 additions and 38 deletions

View File

@@ -139,3 +139,46 @@ test('TodoLogic.moveTodoItem', () => {
},
]);
});
test('TodoLogic.checkTodoItem', () => {
let data = TodoLogic.initTodoData(new Date(0));
data = {
...data,
items: [
{
id: 'a',
listId: '1970-01-01',
label: 'foo',
index: 0,
done: false,
},
{
id: 'b',
listId: '1970-01-01',
label: 'bar',
index: 1,
done: false,
},
],
};
data = TodoLogic.checkTodoItem(data, { id: 'a', done: true });
expect(data.items).toEqual([
{
id: 'a',
listId: '1970-01-01',
label: 'foo',
index: 0,
done: true,
},
{
id: 'b',
listId: '1970-01-01',
label: 'bar',
index: 1,
done: false,
},
]);
});