1
0
mirror of https://github.com/morris/vanilla-todo.git synced 2025-08-22 13:43:06 +02:00
This commit is contained in:
Morris Brodersen
2024-06-23 17:03:30 +02:00
parent 5ab98c2740
commit 1bc68ef68a
3 changed files with 95 additions and 4 deletions

View File

@@ -29,6 +29,7 @@ test('TodoLogic.addTodoItem', () => {
label: 'foo',
index: 0,
done: false,
fixed: true,
},
],
});
@@ -42,6 +43,7 @@ test('TodoLogic.addTodoItem', () => {
label: 'foo',
index: 0,
done: false,
fixed: true,
},
{
id: expect.stringMatching(/./),
@@ -49,6 +51,7 @@ test('TodoLogic.addTodoItem', () => {
label: 'bar',
index: 1,
done: false,
fixed: true,
},
]);
@@ -61,6 +64,7 @@ test('TodoLogic.addTodoItem', () => {
label: 'foo',
index: 0,
done: false,
fixed: true,
},
{
id: expect.stringMatching(/./),
@@ -68,6 +72,7 @@ test('TodoLogic.addTodoItem', () => {
label: 'bar',
index: 1,
done: false,
fixed: true,
},
{
id: expect.stringMatching(/./),
@@ -75,6 +80,7 @@ test('TodoLogic.addTodoItem', () => {
label: 'baz',
index: 0,
done: false,
fixed: true,
},
]);
});
@@ -136,6 +142,42 @@ test('TodoLogic.moveTodoItem', () => {
label: 'foo',
index: 1,
done: false,
fixed: true,
},
]);
data = TodoLogic.moveTodoItem(
data,
{
id: 'a',
listId: '1970-01-02',
index: 0,
},
new Date('1970-01-01'),
);
expect(data.items).toEqual([
{
id: 'b',
listId: '1970-01-01',
label: 'bar',
index: 0,
done: false,
},
{
id: 'a',
listId: '1970-01-02',
label: 'foo',
index: 0,
done: false,
fixed: false,
},
{
id: 'c',
listId: '1970-01-02',
label: 'baz',
index: 1,
done: false,
},
]);
});