import { describe, it, expect } from 'vitest'; import { isPollableDocumensoId } from '@/jobs/processors/documenso-poll'; describe('isPollableDocumensoId', () => { it('skips legacy v1 numeric ids when the port is on the v2 API', () => { // Real prod offenders: abandoned June-3 v1 EOIs whose documenso_id is "46"/"85"/"88". // The v2 /api/v2/envelope/{id} endpoint rejects bare numerics ("Invalid envelope ID"). expect(isPollableDocumensoId('46', 'v2')).toBe(false); expect(isPollableDocumensoId('125', 'v2')).toBe(false); }); it('polls real v2 envelope ids on the v2 API', () => { expect(isPollableDocumensoId('envelope_ydshkombscbhfnfd', 'v2')).toBe(true); }); it('still polls numeric ids for a port that is on the v1 API', () => { expect(isPollableDocumensoId('46', 'v1')).toBe(true); expect(isPollableDocumensoId('envelope_abc', 'v1')).toBe(true); }); });