|
8 | 8 | getPolicyNameByID, |
9 | 9 | getRateDisplayValue, |
10 | 10 | getSubmitToAccountID, |
| 11 | + getTagList, |
| 12 | + getTagListByOrderWeight, |
11 | 13 | getUnitRateValue, |
12 | 14 | isUserInvitedToWorkspace, |
13 | 15 | shouldShowPolicy, |
@@ -172,6 +174,20 @@ const rules = { |
172 | 174 | }, |
173 | 175 | ], |
174 | 176 | }; |
| 177 | +const policyTags = { |
| 178 | + TagListTest0: { |
| 179 | + name: 'TagListTest0', |
| 180 | + orderWeight: 0, |
| 181 | + required: false, |
| 182 | + tags: {}, |
| 183 | + }, |
| 184 | + TagListTest2: { |
| 185 | + name: 'TagListTest2', |
| 186 | + orderWeight: 2, |
| 187 | + required: false, |
| 188 | + tags: {}, |
| 189 | + }, |
| 190 | +}; |
175 | 191 |
|
176 | 192 | describe('PolicyUtils', () => { |
177 | 193 | describe('getActivePolicies', () => { |
@@ -818,4 +834,24 @@ describe('PolicyUtils', () => { |
818 | 834 | expect(result).toBeTruthy(); |
819 | 835 | }); |
820 | 836 | }); |
| 837 | + describe('getTagList', () => { |
| 838 | + it.each([ |
| 839 | + ['when index is 0', 0, policyTags.TagListTest0.name], |
| 840 | + ['when index is 1', 1, policyTags.TagListTest2.name], |
| 841 | + ['when index is out of range', 2, ''], |
| 842 | + ])('%s', (_description, index, expected) => { |
| 843 | + const tagList = getTagList(policyTags, index); |
| 844 | + expect(tagList.name).toEqual(expected); |
| 845 | + }); |
| 846 | + }); |
| 847 | + describe('getTagListByOrderWeight', () => { |
| 848 | + it.each([ |
| 849 | + ['when orderWeight is 0', 0, policyTags.TagListTest0.name], |
| 850 | + ['when orderWeight is 2', 2, policyTags.TagListTest2.name], |
| 851 | + ['when orderWeight is out of range', 1, ''], |
| 852 | + ])('%s', (_description, index, expected) => { |
| 853 | + const tagList = getTagListByOrderWeight(policyTags, index); |
| 854 | + expect(tagList.name).toEqual(expected); |
| 855 | + }); |
| 856 | + }); |
821 | 857 | }); |
0 commit comments