|
1 | | -import {getUnsupportedReportFieldFormulaParts, hasFormulaPartsInInitialValue, isReportFieldNameExisting} from '@libs/WorkspaceReportFieldUtils'; |
| 1 | +import {hasFormulaPartsInInitialValue, isReportFieldNameExisting} from '@libs/WorkspaceReportFieldUtils'; |
2 | 2 | import type {PolicyReportField} from '@src/types/onyx/Policy'; |
3 | 3 |
|
4 | 4 | describe('WorkspaceReportFieldUtils.hasFormulaPartsInInitialValue', () => { |
@@ -41,40 +41,6 @@ describe('WorkspaceReportFieldUtils.hasFormulaPartsInInitialValue', () => { |
41 | 41 | }); |
42 | 42 | }); |
43 | 43 |
|
44 | | -describe('WorkspaceReportFieldUtils.getUnsupportedReportFieldFormulaParts', () => { |
45 | | - it('returns empty array for empty or non-string input', () => { |
46 | | - expect(getUnsupportedReportFieldFormulaParts()).toEqual([]); |
47 | | - expect(getUnsupportedReportFieldFormulaParts('')).toEqual([]); |
48 | | - }); |
49 | | - |
50 | | - it('returns unsupported report tokens like {report:i}', () => { |
51 | | - expect(getUnsupportedReportFieldFormulaParts('{report:i}')).toEqual(['{report:i}']); |
52 | | - expect(getUnsupportedReportFieldFormulaParts('prefix {report:i} suffix')).toEqual(['{report:i}']); |
53 | | - }); |
54 | | - |
55 | | - it('returns empty array for supported report tokens', () => { |
56 | | - expect(getUnsupportedReportFieldFormulaParts('{report:id}')).toEqual([]); |
57 | | - expect(getUnsupportedReportFieldFormulaParts('{report:status}')).toEqual([]); |
58 | | - expect(getUnsupportedReportFieldFormulaParts('{report:submit:from:firstname}')).toEqual([]); |
59 | | - expect(getUnsupportedReportFieldFormulaParts('{report:autoreporting:start}')).toEqual([]); |
60 | | - }); |
61 | | - |
62 | | - it('returns only unsupported parts in mixed formulas', () => { |
63 | | - expect(getUnsupportedReportFieldFormulaParts('Hello {report:id} and {report:invalid}')).toEqual(['{report:invalid}']); |
64 | | - expect(getUnsupportedReportFieldFormulaParts('{report:i} {report:unknown}')).toEqual(['{report:i}', '{report:unknown}']); |
65 | | - }); |
66 | | - |
67 | | - it('ignores non-report parts (field, user, freetext)', () => { |
68 | | - expect(getUnsupportedReportFieldFormulaParts('{field:myField}')).toEqual([]); |
69 | | - expect(getUnsupportedReportFieldFormulaParts('plain text')).toEqual([]); |
70 | | - }); |
71 | | - |
72 | | - it('rejects invalid submit and autoreporting subfields', () => { |
73 | | - expect(getUnsupportedReportFieldFormulaParts('{report:submit:invalid}')).toEqual(['{report:submit:invalid}']); |
74 | | - expect(getUnsupportedReportFieldFormulaParts('{report:autoreporting:invalid}')).toEqual(['{report:autoreporting:invalid}']); |
75 | | - }); |
76 | | -}); |
77 | | - |
78 | 44 | describe('WorkspaceReportFieldUtils.isReportFieldNameExisting', () => { |
79 | 45 | const fieldList: Record<string, PolicyReportField> = { |
80 | 46 | field1: {name: 'Field1', type: 'text'} as PolicyReportField, |
|
0 commit comments