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' },
    ]);
  });
});
