/
githubmirror
/
novu
Обзор
Документация
Войти
/
githubmirror
/
novu
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
next
apps/api/src/app/subscriptions/utils/subscriptions.spec.ts
48 строк
1 KB
George Djabarov
fix(api-service): preserve enabled on workflowId preference shape fixes NV-8458 (#12154)
30 июл 2026, 14:21
Не верифицирован
30 июл 2026, 14:21
65171dd
Код
Авторство
О чём код?
import { expect } from 'chai'; import { convertPreferencesToGroupFilters } from './subscriptions'; describe('convertPreferencesToGroupFilters', () => { it('should convert a string workflow id into a group filter', () => { const result = convertPreferencesToGroupFilters(['workflow-1']); expect(result).to.deep.equal([ { filter: { workflowIds: ['workflow-1'], }, }, ]); }); it('should pass through group filter preferences unchanged', () => { const preference = { filter: { workflowIds: ['workflow-1'] }, enabled: false, condition: { '==': [{ var: 'status' }, 'active'] }, }; const result = convertPreferencesToGroupFilters([preference]); expect(result).to.deep.equal([preference]); }); it('should preserve enabled and condition when converting the workflowId shape', () => { const result = convertPreferencesToGroupFilters([ { workflowId: 'workflow-1', enabled: false, condition: { '==': [{ var: 'tier' }, 'premium'] }, }, ]); expect(result).to.deep.equal([ { filter: { workflowIds: ['workflow-1'], }, condition: { '==': [{ var: 'tier' }, 'premium'] }, enabled: false, }, ]); }); });