feat(RECIPE-0009): complete iteration 0 — deduplication, notifications, UI improvements
This commit is contained in:
@@ -353,4 +353,28 @@ describe('QueueManager', () => {
|
||||
expect(callback3).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('deduplication', () => {
|
||||
it('should return existing item when enqueueing duplicate URL', () => {
|
||||
const url = 'https://instagram.com/p/ABC123';
|
||||
const firstItem = queueManager.enqueue(url);
|
||||
const secondItem = queueManager.enqueue(url);
|
||||
|
||||
expect(secondItem.id).toBe(firstItem.id);
|
||||
expect(queueManager.getAll()).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('should find item by URL', () => {
|
||||
const url = 'https://instagram.com/p/TEST123';
|
||||
const item = queueManager.enqueue(url);
|
||||
|
||||
const found = queueManager.findByUrl(url);
|
||||
expect(found?.id).toBe(item.id);
|
||||
});
|
||||
|
||||
it('should return undefined when URL not found', () => {
|
||||
const found = queueManager.findByUrl('https://instagram.com/p/NOTFOUND');
|
||||
expect(found).toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user