import { describe, expect, it } from 'vitest'; import { jobId, QUEUE_NAMES } from '../src/queue.js'; describe('jobId', () => { it('is deterministic per (channel, notificationId) for dedupe', () => { const a = jobId({ channel: 'fcm', notificationId: 'abc' }); const b = jobId({ channel: 'fcm', notificationId: 'abc' }); expect(a).toBe(b); }); it('never contains ":" (BullMQ rejects custom ids with a colon)', () => { expect(jobId({ channel: 'fcm', notificationId: '6a540e689f1e1fd0f9a98788' })).not.toContain(':'); expect(jobId({ channel: 'email', notificationId: 'x' })).not.toContain(':'); }); it('distinguishes channels for the same notification', () => { expect(jobId({ channel: 'fcm', notificationId: 'x' })).not.toBe(jobId({ channel: 'email', notificationId: 'x' })); }); it('queue names are colon-free too', () => { expect(QUEUE_NAMES.fcm).not.toContain(':'); expect(QUEUE_NAMES.email).not.toContain(':'); }); });