Deduplicate guest tasks list and restore header icon
This commit is contained in:
22
resources/js/guest/lib/__tests__/taskUtils.test.ts
Normal file
22
resources/js/guest/lib/__tests__/taskUtils.test.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { dedupeTasksById } from '../taskUtils';
|
||||
|
||||
describe('dedupeTasksById', () => {
|
||||
it('returns empty array for empty input', () => {
|
||||
expect(dedupeTasksById([])).toEqual([]);
|
||||
});
|
||||
|
||||
it('keeps the first occurrence and preserves order', () => {
|
||||
const tasks = [
|
||||
{ id: 1, title: 'A' },
|
||||
{ id: 2, title: 'B' },
|
||||
{ id: 1, title: 'A-dup' },
|
||||
{ id: 3, title: 'C' },
|
||||
];
|
||||
|
||||
expect(dedupeTasksById(tasks)).toEqual([
|
||||
{ id: 1, title: 'A' },
|
||||
{ id: 2, title: 'B' },
|
||||
{ id: 3, title: 'C' },
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user