@ukhomeoffice/cop-react-form-renderer 6.0.6-peter → 6.7.0-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (390) hide show
  1. package/dist/components/CheckYourAnswers/Answer.js +12 -12
  2. package/dist/components/CheckYourAnswers/Answer.test.js +92 -127
  3. package/dist/components/CheckYourAnswers/CheckYourAnswers.js +101 -131
  4. package/dist/components/CheckYourAnswers/CheckYourAnswers.scss +2 -2
  5. package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +463 -769
  6. package/dist/components/CollectionPage/CollectionPage.js +75 -59
  7. package/dist/components/CollectionPage/CollectionPage.test.js +316 -366
  8. package/dist/components/CollectionSummary/BannerStrip.js +15 -14
  9. package/dist/components/CollectionSummary/BannerStrip.scss +2 -2
  10. package/dist/components/CollectionSummary/BannerStrip.test.js +98 -59
  11. package/dist/components/CollectionSummary/CollectionSummary.js +144 -135
  12. package/dist/components/CollectionSummary/CollectionSummary.scss +1 -1
  13. package/dist/components/CollectionSummary/CollectionSummary.test.js +167 -197
  14. package/dist/components/CollectionSummary/Confirmation.js +14 -12
  15. package/dist/components/CollectionSummary/Confirmation.scss +1 -1
  16. package/dist/components/CollectionSummary/Confirmation.test.js +68 -63
  17. package/dist/components/CollectionSummary/RenderListView.js +54 -56
  18. package/dist/components/CollectionSummary/RenderListView.scss +10 -1
  19. package/dist/components/CollectionSummary/RenderListView.test.js +89 -78
  20. package/dist/components/CollectionSummary/SummaryCard.js +135 -145
  21. package/dist/components/CollectionSummary/SummaryCard.scss +2 -1
  22. package/dist/components/CollectionSummary/SummaryCard.test.js +943 -932
  23. package/dist/components/CollectionSummary/SummaryCardDetails.js +120 -62
  24. package/dist/components/CollectionSummary/SummaryCardDetails.scss +43 -6
  25. package/dist/components/CollectionSummary/SummaryCardDetails.test.js +261 -120
  26. package/dist/components/CollectionSummary/SummaryCardValidationContext.js +38 -33
  27. package/dist/components/CollectionSummary/SummaryCardValidationContext.test.js +62 -73
  28. package/dist/components/FormComponent/Collection.js +81 -108
  29. package/dist/components/FormComponent/Collection.test.js +909 -943
  30. package/dist/components/FormComponent/Container.js +40 -38
  31. package/dist/components/FormComponent/Container.test.js +314 -345
  32. package/dist/components/FormComponent/FormComponent.js +80 -71
  33. package/dist/components/FormComponent/FormComponent.test.js +353 -414
  34. package/dist/components/FormComponent/helpers/addLabel.js +4 -7
  35. package/dist/components/FormComponent/helpers/getComponentDisabled.js +1 -1
  36. package/dist/components/FormComponent/helpers/getComponentDisabled.test.js +7 -7
  37. package/dist/components/FormComponent/helpers/getComponentError.js +3 -5
  38. package/dist/components/FormComponent/helpers/getComponentError.test.js +14 -14
  39. package/dist/components/FormComponent/helpers/getComponentFieldSet.js +3 -4
  40. package/dist/components/FormComponent/helpers/getComponentFieldSet.test.js +6 -6
  41. package/dist/components/FormComponent/helpers/index.js +4 -4
  42. package/dist/components/FormPage/FormPage.js +65 -80
  43. package/dist/components/FormPage/FormPage.scss +1 -1
  44. package/dist/components/FormPage/FormPage.test.js +127 -163
  45. package/dist/components/FormRenderer/FormRenderer.js +150 -183
  46. package/dist/components/FormRenderer/FormRenderer.scss +1 -1
  47. package/dist/components/FormRenderer/FormRenderer.test.js +730 -1115
  48. package/dist/components/FormRenderer/handlers/cyaAction.js +2 -2
  49. package/dist/components/FormRenderer/handlers/getPageId.js +1 -3
  50. package/dist/components/FormRenderer/handlers/getPageId.test.js +14 -14
  51. package/dist/components/FormRenderer/handlers/handlers.test.js +32 -32
  52. package/dist/components/FormRenderer/handlers/index.js +1 -1
  53. package/dist/components/FormRenderer/handlers/navigate.js +3 -3
  54. package/dist/components/FormRenderer/handlers/submissionError.js +1 -1
  55. package/dist/components/FormRenderer/helpers/canActionProceed.js +1 -1
  56. package/dist/components/FormRenderer/helpers/canActionProceed.test.js +15 -15
  57. package/dist/components/FormRenderer/helpers/canCYASubmit.js +1 -3
  58. package/dist/components/FormRenderer/helpers/canCYASubmit.test.js +16 -20
  59. package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.js +17 -22
  60. package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.test.js +16 -16
  61. package/dist/components/FormRenderer/helpers/getCYA.js +3 -5
  62. package/dist/components/FormRenderer/helpers/getCYA.test.js +11 -11
  63. package/dist/components/FormRenderer/helpers/getFormState.js +5 -7
  64. package/dist/components/FormRenderer/helpers/getFormState.test.js +10 -10
  65. package/dist/components/FormRenderer/helpers/getNextPageId.js +13 -24
  66. package/dist/components/FormRenderer/helpers/getNextPageId.test.js +67 -67
  67. package/dist/components/FormRenderer/helpers/getPage.js +2 -4
  68. package/dist/components/FormRenderer/helpers/getPage.test.js +11 -11
  69. package/dist/components/FormRenderer/helpers/getRelevantPages.js +7 -9
  70. package/dist/components/FormRenderer/helpers/getRelevantPages.test.js +14 -14
  71. package/dist/components/FormRenderer/helpers/getSubmissionStatus.js +5 -5
  72. package/dist/components/FormRenderer/helpers/getSubmissionStatus.test.js +103 -97
  73. package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.js +62 -60
  74. package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.test.js +71 -78
  75. package/dist/components/FormRenderer/helpers/index.js +2 -4
  76. package/dist/components/FormRenderer/onCYAAction.js +59 -51
  77. package/dist/components/FormRenderer/onCYAAction.test.js +164 -152
  78. package/dist/components/FormRenderer/onPageAction.js +50 -48
  79. package/dist/components/FormRenderer/onPageAction.test.js +241 -217
  80. package/dist/components/FormRenderer/onTaskAction.js +9 -13
  81. package/dist/components/FormRenderer/onTaskAction.test.js +93 -88
  82. package/dist/components/PageActions/ActionButton.js +12 -15
  83. package/dist/components/PageActions/ActionButton.test.js +56 -78
  84. package/dist/components/PageActions/PageActions.js +10 -10
  85. package/dist/components/PageActions/PageActions.test.js +86 -115
  86. package/dist/components/SummaryList/GroupAction.js +9 -17
  87. package/dist/components/SummaryList/GroupAction.test.js +37 -33
  88. package/dist/components/SummaryList/RowAction.js +11 -16
  89. package/dist/components/SummaryList/RowAction.test.js +37 -33
  90. package/dist/components/SummaryList/SummaryList.js +21 -26
  91. package/dist/components/SummaryList/SummaryList.scss +2 -2
  92. package/dist/components/SummaryList/SummaryList.test.js +143 -166
  93. package/dist/components/SummaryList/SummaryListHeadingRow.js +6 -4
  94. package/dist/components/SummaryList/SummaryListRow.js +6 -4
  95. package/dist/components/SummaryList/SummaryListTitleRow.js +5 -3
  96. package/dist/components/SummaryList/helpers/getGroupActionAttributes.js +3 -5
  97. package/dist/components/SummaryList/helpers/getGroupActionAttributes.test.js +22 -22
  98. package/dist/components/SummaryList/helpers/getRowActionAttributes.js +3 -5
  99. package/dist/components/SummaryList/helpers/getRowActionAttributes.test.js +22 -22
  100. package/dist/components/SummaryList/helpers/index.js +1 -1
  101. package/dist/components/TaskList/Task.js +19 -29
  102. package/dist/components/TaskList/Task.test.js +83 -76
  103. package/dist/components/TaskList/TaskList.js +45 -71
  104. package/dist/components/TaskList/TaskList.scss +1 -1
  105. package/dist/components/TaskList/TaskList.test.js +113 -111
  106. package/dist/components/TaskList/TaskState.js +7 -5
  107. package/dist/components/TaskList/TaskState.test.js +52 -45
  108. package/dist/components/index.js +7 -7
  109. package/dist/context/HooksContext/HooksContext.js +57 -80
  110. package/dist/context/HooksContext/HooksContext.test.js +26 -35
  111. package/dist/context/HooksContext/index.js +3 -4
  112. package/dist/context/ValidationContext/ValidationContext.js +65 -72
  113. package/dist/context/ValidationContext/ValidationContext.test.js +58 -61
  114. package/dist/context/ValidationContext/index.js +3 -4
  115. package/dist/context/index.js +2 -2
  116. package/dist/hooks/index.js +9 -10
  117. package/dist/hooks/useAxios.js +14 -40
  118. package/dist/hooks/useGetRequest.js +61 -97
  119. package/dist/hooks/useHooks.js +1 -3
  120. package/dist/hooks/useRefData.js +27 -40
  121. package/dist/hooks/useValidation.js +1 -3
  122. package/dist/index.js +13 -14
  123. package/dist/models/CollectionLabels.js +1 -1
  124. package/dist/models/ComponentTypes.js +25 -25
  125. package/dist/models/EventTypes.js +4 -4
  126. package/dist/models/FormPages.js +4 -4
  127. package/dist/models/FormTypes.js +8 -8
  128. package/dist/models/HubFormats.js +3 -3
  129. package/dist/models/PageAction.js +44 -38
  130. package/dist/models/TaskStates.js +29 -28
  131. package/dist/models/index.js +9 -9
  132. package/dist/setupTests.js +30 -31
  133. package/dist/utils/CheckYourAnswers/getCYAAction.js +5 -5
  134. package/dist/utils/CheckYourAnswers/getCYAAction.test.js +52 -54
  135. package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.js +15 -25
  136. package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.test.js +33 -35
  137. package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.js +17 -31
  138. package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.test.js +42 -44
  139. package/dist/utils/CheckYourAnswers/getCYARow.js +6 -6
  140. package/dist/utils/CheckYourAnswers/getCYARow.test.js +86 -86
  141. package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +18 -24
  142. package/dist/utils/CheckYourAnswers/getCYARowForGroup.test.js +15 -16
  143. package/dist/utils/CheckYourAnswers/getCYARowsForCollection.js +33 -36
  144. package/dist/utils/CheckYourAnswers/getCYARowsForCollection.test.js +58 -61
  145. package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.js +83 -89
  146. package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.test.js +164 -138
  147. package/dist/utils/CheckYourAnswers/getCYARowsForContainer.js +25 -20
  148. package/dist/utils/CheckYourAnswers/getCYARowsForContainer.test.js +103 -97
  149. package/dist/utils/CheckYourAnswers/getCYARowsForPage.js +13 -18
  150. package/dist/utils/CheckYourAnswers/getCYARowsForPage.test.js +70 -76
  151. package/dist/utils/CheckYourAnswers/getComponentRowForCYA.js +11 -11
  152. package/dist/utils/CheckYourAnswers/getComponentRowForCYA.test.js +7 -7
  153. package/dist/utils/CheckYourAnswers/index.js +1 -1
  154. package/dist/utils/CheckYourAnswers/showComponentCYA.js +4 -5
  155. package/dist/utils/CheckYourAnswers/showComponentCYA.test.js +29 -24
  156. package/dist/utils/CollectionPage/addCollectionPageEntry.js +3 -4
  157. package/dist/utils/CollectionPage/addCollectionPageEntry.test.js +7 -27
  158. package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.js +2 -2
  159. package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.test.js +17 -18
  160. package/dist/utils/CollectionPage/duplicateCollectionPageEntry.js +29 -19
  161. package/dist/utils/CollectionPage/duplicateCollectionPageEntry.test.js +66 -22
  162. package/dist/utils/CollectionPage/getCollectionPageActiveId.js +2 -2
  163. package/dist/utils/CollectionPage/getCollectionPageActiveId.test.js +10 -10
  164. package/dist/utils/CollectionPage/getCollectionPageActiveIndex.js +7 -11
  165. package/dist/utils/CollectionPage/getCollectionPageActiveIndex.test.js +22 -22
  166. package/dist/utils/CollectionPage/getCollectionPageData.js +8 -12
  167. package/dist/utils/CollectionPage/getCollectionPageData.test.js +19 -19
  168. package/dist/utils/CollectionPage/getErrorsForCollection.js +55 -0
  169. package/dist/utils/CollectionPage/getErrorsForCollection.test.js +153 -0
  170. package/dist/utils/CollectionPage/getQuickEditPage.js +37 -23
  171. package/dist/utils/CollectionPage/getQuickEditPage.test.js +26 -45
  172. package/dist/utils/CollectionPage/index.js +3 -1
  173. package/dist/utils/CollectionPage/mergeCollectionPages.js +31 -35
  174. package/dist/utils/CollectionPage/mergeCollectionPages.test.js +20 -20
  175. package/dist/utils/CollectionPage/removeCollectionPageEntry.js +4 -6
  176. package/dist/utils/CollectionPage/removeCollectionPageEntry.test.js +10 -10
  177. package/dist/utils/CollectionPage/setCollectionPageData.js +16 -17
  178. package/dist/utils/CollectionPage/setCollectionPageData.test.js +38 -20
  179. package/dist/utils/Component/addShowWhen.js +4 -8
  180. package/dist/utils/Component/addShowWhen.test.js +37 -37
  181. package/dist/utils/Component/applyToComponentTree.js +18 -18
  182. package/dist/utils/Component/applyToComponentTree.test.js +27 -32
  183. package/dist/utils/Component/cleanAttributes.js +10 -13
  184. package/dist/utils/Component/cleanAttributes.test.js +17 -18
  185. package/dist/utils/Component/elevateNestedComponents.js +5 -5
  186. package/dist/utils/Component/elevateNestedComponents.test.js +30 -30
  187. package/dist/utils/Component/getComponent.js +88 -94
  188. package/dist/utils/Component/getComponentTests/getComponent.autocomplete.test.js +18 -17
  189. package/dist/utils/Component/getComponentTests/getComponent.calculation.test.js +46 -59
  190. package/dist/utils/Component/getComponentTests/getComponent.checkboxes.test.js +39 -48
  191. package/dist/utils/Component/getComponentTests/getComponent.date.test.js +23 -33
  192. package/dist/utils/Component/getComponentTests/getComponent.details.test.js +20 -18
  193. package/dist/utils/Component/getComponentTests/getComponent.email.test.js +17 -22
  194. package/dist/utils/Component/getComponentTests/getComponent.file.test.js +20 -25
  195. package/dist/utils/Component/getComponentTests/getComponent.heading.test.js +10 -9
  196. package/dist/utils/Component/getComponentTests/getComponent.html.test.js +17 -15
  197. package/dist/utils/Component/getComponentTests/getComponent.insetText.test.js +9 -8
  198. package/dist/utils/Component/getComponentTests/getComponent.list.test.js +17 -15
  199. package/dist/utils/Component/getComponentTests/getComponent.multifile.test.js +22 -26
  200. package/dist/utils/Component/getComponentTests/getComponent.nested.test.js +155 -175
  201. package/dist/utils/Component/getComponentTests/getComponent.paragraph.test.js +17 -15
  202. package/dist/utils/Component/getComponentTests/getComponent.phoneNumber.test.js +17 -22
  203. package/dist/utils/Component/getComponentTests/getComponent.radios.test.js +57 -72
  204. package/dist/utils/Component/getComponentTests/getComponent.select.test.js +17 -22
  205. package/dist/utils/Component/getComponentTests/getComponent.text.test.js +17 -22
  206. package/dist/utils/Component/getComponentTests/getComponent.textArea.test.js +31 -38
  207. package/dist/utils/Component/getComponentTests/getComponent.time.test.js +20 -29
  208. package/dist/utils/Component/getComponentTests/getComponent.unknown.test.js +2 -2
  209. package/dist/utils/Component/getComponentTests/getComponent.warningText.test.js +9 -8
  210. package/dist/utils/Component/getDefaultValue.js +6 -8
  211. package/dist/utils/Component/getDefaultValue.test.js +12 -12
  212. package/dist/utils/Component/getDefaultValueFromConfig.js +22 -21
  213. package/dist/utils/Component/getDefaultValueFromConfig.test.js +31 -31
  214. package/dist/utils/Component/index.js +1 -1
  215. package/dist/utils/Component/isEditable.js +2 -4
  216. package/dist/utils/Component/isEditable.test.js +14 -15
  217. package/dist/utils/Component/optionIsSelected.js +1 -1
  218. package/dist/utils/Component/optionIsSelected.test.js +9 -9
  219. package/dist/utils/Component/setupContainerComponentsPath.js +27 -29
  220. package/dist/utils/Component/setupContainerComponentsPath.test.js +11 -11
  221. package/dist/utils/Component/showComponent.js +1 -1
  222. package/dist/utils/Component/showComponent.test.js +28 -28
  223. package/dist/utils/Component/wrapInFormGroup.js +2 -2
  224. package/dist/utils/Condition/index.js +1 -1
  225. package/dist/utils/Condition/meetsAllConditions.js +8 -8
  226. package/dist/utils/Condition/meetsAllConditions.test.js +20 -20
  227. package/dist/utils/Condition/meetsCondition.js +28 -19
  228. package/dist/utils/Condition/meetsCondition.test.js +476 -376
  229. package/dist/utils/Condition/meetsOneCondition.js +5 -5
  230. package/dist/utils/Condition/meetsOneCondition.test.js +16 -16
  231. package/dist/utils/Condition/setupConditions.js +13 -18
  232. package/dist/utils/Condition/setupConditions.test.js +7 -7
  233. package/dist/utils/Container/getEditableComponents.js +3 -5
  234. package/dist/utils/Container/getEditableComponents.test.js +43 -45
  235. package/dist/utils/Container/index.js +1 -1
  236. package/dist/utils/Container/setupNesting.js +16 -20
  237. package/dist/utils/Container/setupNesting.test.js +27 -30
  238. package/dist/utils/Container/showContainer.js +3 -7
  239. package/dist/utils/Container/showContainer.test.js +30 -30
  240. package/dist/utils/Data/applyFormula.js +38 -48
  241. package/dist/utils/Data/applyFormula.test.js +20 -20
  242. package/dist/utils/Data/getAutocompleteSource.js +18 -26
  243. package/dist/utils/Data/getAutocompleteSource.test.js +80 -86
  244. package/dist/utils/Data/getDataPath.js +18 -28
  245. package/dist/utils/Data/getDataPath.test.js +12 -12
  246. package/dist/utils/Data/getOptions.js +29 -25
  247. package/dist/utils/Data/getOptions.test.js +93 -20
  248. package/dist/utils/Data/getSourceData.js +6 -19
  249. package/dist/utils/Data/getSourceData.test.js +84 -80
  250. package/dist/utils/Data/index.js +1 -1
  251. package/dist/utils/Data/nestInRefdataOptions.js +42 -0
  252. package/dist/utils/Data/nestInRefdataOptions.test.js +236 -0
  253. package/dist/utils/Data/refDataToOptions.js +10 -13
  254. package/dist/utils/Data/refDataToOptions.test.js +19 -19
  255. package/dist/utils/Data/setDataItem.js +7 -8
  256. package/dist/utils/Data/setDataItem.test.js +37 -37
  257. package/dist/utils/Data/setupFormData.js +13 -21
  258. package/dist/utils/Data/setupFormData.test.js +51 -50
  259. package/dist/utils/Data/setupRefDataUrlForComponent.js +20 -26
  260. package/dist/utils/Data/setupRefDataUrlForComponent.test.js +24 -24
  261. package/dist/utils/FormPage/applyConditionalProperties.js +5 -9
  262. package/dist/utils/FormPage/applyConditionalProperties.test.js +15 -18
  263. package/dist/utils/FormPage/getConditionalText.js +3 -3
  264. package/dist/utils/FormPage/getConditionalText.test.js +29 -29
  265. package/dist/utils/FormPage/getFormPage.js +15 -16
  266. package/dist/utils/FormPage/getFormPage.test.js +47 -46
  267. package/dist/utils/FormPage/getFormPages.js +7 -12
  268. package/dist/utils/FormPage/getFormPages.test.js +20 -23
  269. package/dist/utils/FormPage/getPageActions.js +9 -15
  270. package/dist/utils/FormPage/getPageActions.test.js +32 -32
  271. package/dist/utils/FormPage/getParagraphFromText.js +5 -7
  272. package/dist/utils/FormPage/getParagraphFromText.test.js +6 -6
  273. package/dist/utils/FormPage/index.js +2 -4
  274. package/dist/utils/FormPage/showFormPage.js +3 -7
  275. package/dist/utils/FormPage/showFormPage.test.js +32 -32
  276. package/dist/utils/FormPage/showFormPageCYA.js +1 -1
  277. package/dist/utils/FormPage/showFormPageCYA.test.js +8 -8
  278. package/dist/utils/FormPage/useComponent.js +21 -28
  279. package/dist/utils/FormPage/useComponent.test.js +77 -79
  280. package/dist/utils/Format/formatData.js +1 -1
  281. package/dist/utils/Format/formatData.test.js +18 -18
  282. package/dist/utils/Format/formatDataForComponent.js +5 -6
  283. package/dist/utils/Format/formatDataForComponent.test.js +50 -78
  284. package/dist/utils/Format/formatDataForForm.js +6 -8
  285. package/dist/utils/Format/formatDataForForm.test.js +13 -16
  286. package/dist/utils/Format/formatDataForPage.js +4 -5
  287. package/dist/utils/Format/formatDataForPage.test.js +20 -25
  288. package/dist/utils/Format/index.js +1 -1
  289. package/dist/utils/Hub/getFormHub.js +1 -1
  290. package/dist/utils/Hub/getFormHub.test.js +28 -31
  291. package/dist/utils/Hub/index.js +1 -1
  292. package/dist/utils/Meta/constants.js +2 -2
  293. package/dist/utils/Meta/documents/getDocuments.js +1 -1
  294. package/dist/utils/Meta/documents/getDocuments.test.js +24 -16
  295. package/dist/utils/Meta/documents/index.js +1 -1
  296. package/dist/utils/Meta/documents/setDocumentsForField.js +14 -16
  297. package/dist/utils/Meta/documents/setDocumentsForField.test.js +68 -34
  298. package/dist/utils/Meta/index.js +1 -1
  299. package/dist/utils/Operate/checkValueIsTruthy.js +2 -2
  300. package/dist/utils/Operate/checkValueIsTruthy.test.js +16 -16
  301. package/dist/utils/Operate/getFirstOf.js +5 -5
  302. package/dist/utils/Operate/getFirstOf.test.js +31 -31
  303. package/dist/utils/Operate/getIndexOfMatchingValueIn.js +10 -10
  304. package/dist/utils/Operate/getIndexOfMatchingValueIn.test.js +46 -52
  305. package/dist/utils/Operate/index.js +1 -1
  306. package/dist/utils/Operate/persistValueInFormData.js +3 -3
  307. package/dist/utils/Operate/persistValueInFormData.test.js +22 -20
  308. package/dist/utils/Operate/runPageOperations.js +7 -7
  309. package/dist/utils/Operate/runPageOperations.test.js +35 -36
  310. package/dist/utils/Operate/setValueInFormData.js +2 -2
  311. package/dist/utils/Operate/setValueInFormData.test.js +16 -16
  312. package/dist/utils/Operate/shouldRun.js +6 -6
  313. package/dist/utils/Operate/shouldRun.test.js +21 -27
  314. package/dist/utils/Validate/additional/conditionallyRequired.js +4 -4
  315. package/dist/utils/Validate/additional/conditionallyRequired.test.js +18 -18
  316. package/dist/utils/Validate/additional/index.js +6 -6
  317. package/dist/utils/Validate/additional/index.test.js +12 -12
  318. package/dist/utils/Validate/additional/mustBeAfter.js +2 -2
  319. package/dist/utils/Validate/additional/mustBeAfter.test.js +40 -40
  320. package/dist/utils/Validate/additional/mustBeBefore.js +2 -2
  321. package/dist/utils/Validate/additional/mustBeBefore.test.js +28 -28
  322. package/dist/utils/Validate/additional/mustBeEarlierDateTime.js +7 -11
  323. package/dist/utils/Validate/additional/mustBeEarlierDateTime.test.js +37 -41
  324. package/dist/utils/Validate/additional/mustBeGreaterThan.js +2 -2
  325. package/dist/utils/Validate/additional/mustBeGreaterThan.test.js +18 -18
  326. package/dist/utils/Validate/additional/mustBeInTheFuture.js +2 -2
  327. package/dist/utils/Validate/additional/mustBeInTheFuture.test.js +12 -12
  328. package/dist/utils/Validate/additional/mustBeInThePast.js +3 -3
  329. package/dist/utils/Validate/additional/mustBeInThePast.test.js +12 -12
  330. package/dist/utils/Validate/additional/mustBeLessThan.js +2 -2
  331. package/dist/utils/Validate/additional/mustBeLessThan.test.js +17 -17
  332. package/dist/utils/Validate/additional/mustBeLongerThan.js +1 -1
  333. package/dist/utils/Validate/additional/mustBeLongerThan.test.js +16 -16
  334. package/dist/utils/Validate/additional/mustBeNumbersOnly.js +2 -2
  335. package/dist/utils/Validate/additional/mustBeNumbersOnly.test.js +20 -20
  336. package/dist/utils/Validate/additional/mustBeShorterThan.js +1 -1
  337. package/dist/utils/Validate/additional/mustBeShorterThan.test.js +16 -16
  338. package/dist/utils/Validate/additional/mustBeUniqueInCollection.js +8 -4
  339. package/dist/utils/Validate/additional/mustBeUniqueInCollection.test.js +64 -32
  340. package/dist/utils/Validate/additional/mustEnterAtLeastOne.js +2 -2
  341. package/dist/utils/Validate/additional/mustEnterAtLeastOne.test.js +14 -16
  342. package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.js +1 -1
  343. package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.test.js +12 -12
  344. package/dist/utils/Validate/additional/mustNotContainSql.js +3 -4
  345. package/dist/utils/Validate/additional/mustNotContainSql.test.js +14 -14
  346. package/dist/utils/Validate/additional/mustSelectOnlyOne.js +2 -2
  347. package/dist/utils/Validate/additional/mustSelectOnlyOne.test.js +28 -26
  348. package/dist/utils/Validate/additional/utils.js +9 -22
  349. package/dist/utils/Validate/index.js +1 -1
  350. package/dist/utils/Validate/validateCollection.js +19 -25
  351. package/dist/utils/Validate/validateCollection.test.js +74 -66
  352. package/dist/utils/Validate/validateComponent.js +17 -15
  353. package/dist/utils/Validate/validateComponent.test.js +167 -146
  354. package/dist/utils/Validate/validateContainer.js +16 -19
  355. package/dist/utils/Validate/validateContainer.test.js +84 -45
  356. package/dist/utils/Validate/validateDate.js +15 -21
  357. package/dist/utils/Validate/validateDate.test.js +31 -32
  358. package/dist/utils/Validate/validateEmail.js +6 -8
  359. package/dist/utils/Validate/validateEmail.test.js +25 -25
  360. package/dist/utils/Validate/validateMultifile.js +5 -7
  361. package/dist/utils/Validate/validateMultifile.test.js +17 -18
  362. package/dist/utils/Validate/validatePage.js +24 -18
  363. package/dist/utils/Validate/validatePage.test.js +263 -182
  364. package/dist/utils/Validate/validateRegex.js +3 -5
  365. package/dist/utils/Validate/validateRegex.test.js +14 -14
  366. package/dist/utils/Validate/validateRequired.js +4 -6
  367. package/dist/utils/Validate/validateRequired.test.js +18 -18
  368. package/dist/utils/Validate/validateTextArea.js +4 -6
  369. package/dist/utils/Validate/validateTextArea.test.js +20 -20
  370. package/dist/utils/Validate/validateTime.js +11 -18
  371. package/dist/utils/Validate/validateTime.test.js +16 -16
  372. package/dist/utils/index.js +7 -9
  373. package/package.json +5 -5
  374. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/component-used-in-multiple-pages-data.json +0 -4
  375. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/component-used-in-multiple-pages-form.json +0 -61
  376. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/data-with-collection-data-removed.json +0 -4
  377. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/data-with-collections.json +0 -8
  378. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/data-with-components-removed.json +0 -3
  379. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/data-with-components.json +0 -5
  380. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/data-with-entire-collection-removed.json +0 -3
  381. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/data-with-nested-component-removed.json +0 -10
  382. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/data-with-nested-components.json +0 -11
  383. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/form-for-nested-components.json +0 -96
  384. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/form-with-collections-delete-entire.json +0 -47
  385. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/form-with-collections.json +0 -46
  386. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/form-with-components.json +0 -48
  387. package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutes.js +0 -175
  388. package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutes.test.js +0 -113
  389. package/dist/components/FormRenderer/helpers/deleteNodeByPath.js +0 -20
  390. package/dist/components/FormRenderer/helpers/deleteNodeByPath.test.js +0 -56
@@ -4,8 +4,8 @@ var _meetsCondition = _interopRequireDefault(require("./meetsCondition"));
4
4
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5
5
  // Local imports
6
6
 
7
- describe('utils.Condition.meetsCondition', function () {
8
- var getCondition = function getCondition(operator, val) {
7
+ describe('utils.Condition.meetsCondition', () => {
8
+ const getCondition = (operator, val) => {
9
9
  if (['in', 'nin'].includes(operator)) {
10
10
  return {
11
11
  op: operator,
@@ -17,759 +17,859 @@ describe('utils.Condition.meetsCondition', function () {
17
17
  value: val
18
18
  };
19
19
  };
20
- var TEST_VALUES = ['a', 'b', 3, 4, null, undefined, true, false, 0];
21
- describe('equality operators', function () {
22
- ['eq', '='].forEach(function (op) {
23
- describe("operator ".concat(op), function () {
20
+ const TEST_VALUES = ['a', 'b', 3, 4, null, undefined, true, false, 0];
21
+ describe('equality operators', () => {
22
+ ['eq', '='].forEach(op => {
23
+ describe("operator ".concat(op), () => {
24
24
  // Should match...
25
- it('should match two nulls', function () {
26
- var VALUE = null;
27
- var CONDITION = getCondition(op, null);
25
+ it('should match two nulls', () => {
26
+ const VALUE = null;
27
+ const CONDITION = getCondition(op, null);
28
28
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
29
29
  });
30
- it('should match two undefineds', function () {
31
- var VALUE = undefined;
32
- var CONDITION = getCondition(op, undefined);
30
+ it('should match two undefineds', () => {
31
+ const VALUE = undefined;
32
+ const CONDITION = getCondition(op, undefined);
33
33
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
34
34
  });
35
- it('should match two identical strings', function () {
36
- var VALUE = 'value';
37
- var CONDITION = getCondition(op, 'value');
35
+ it('should match two identical strings', () => {
36
+ const VALUE = 'value';
37
+ const CONDITION = getCondition(op, 'value');
38
38
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
39
39
  });
40
- it('should match two empty strings', function () {
41
- var VALUE = '';
42
- var CONDITION = getCondition(op, '');
40
+ it('should match two empty strings', () => {
41
+ const VALUE = '';
42
+ const CONDITION = getCondition(op, '');
43
43
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
44
44
  });
45
- it('should match two identical numbers', function () {
46
- var VALUE = 3;
47
- var CONDITION = getCondition(op, 3);
45
+ it('should match two identical numbers', () => {
46
+ const VALUE = 3;
47
+ const CONDITION = getCondition(op, 3);
48
48
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
49
49
  });
50
- it('should match two zeroes', function () {
51
- var VALUE = 0;
52
- var CONDITION = getCondition(op, 0);
50
+ it('should match two zeroes', () => {
51
+ const VALUE = 0;
52
+ const CONDITION = getCondition(op, 0);
53
53
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
54
54
  });
55
- it('should match two boolean trues', function () {
56
- var VALUE = true;
57
- var CONDITION = getCondition(op, true);
55
+ it('should match two boolean trues', () => {
56
+ const VALUE = true;
57
+ const CONDITION = getCondition(op, true);
58
58
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
59
59
  });
60
- it('should match two boolean falses', function () {
61
- var VALUE = false;
62
- var CONDITION = getCondition(op, false);
60
+ it('should match two boolean falses', () => {
61
+ const VALUE = false;
62
+ const CONDITION = getCondition(op, false);
63
63
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
64
64
  });
65
- it('should match environmentContext value with data object', function () {
66
- var VALUE = 'Bob';
67
- var DATA = {
65
+ it('should match environmentContext value with data object', () => {
66
+ const VALUE = 'Bob';
67
+ const DATA = {
68
68
  environmentContext: {
69
69
  currentUser: 'Bob'
70
70
  }
71
71
  };
72
- var CONDITION = getCondition(op, 'field::environmentContext.currentUser');
72
+ const CONDITION = getCondition(op, 'field::environmentContext.currentUser');
73
73
  expect((0, _meetsCondition.default)(CONDITION, VALUE, DATA)).toBeTruthy();
74
74
  });
75
75
 
76
76
  // Should reject...
77
- it('should reject a null and undefined', function () {
78
- var VALUE = null;
79
- var CONDITION = getCondition(op, undefined);
77
+ it('should reject a null and undefined', () => {
78
+ const VALUE = null;
79
+ const CONDITION = getCondition(op, undefined);
80
80
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
81
81
  });
82
- it('should reject a null and empty string', function () {
83
- var VALUE = null;
84
- var CONDITION = getCondition(op, '');
82
+ it('should reject a null and empty string', () => {
83
+ const VALUE = null;
84
+ const CONDITION = getCondition(op, '');
85
85
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
86
86
  });
87
- it('should reject an undefined and empty string', function () {
88
- var VALUE = undefined;
89
- var CONDITION = getCondition(op, '');
87
+ it('should reject an undefined and empty string', () => {
88
+ const VALUE = undefined;
89
+ const CONDITION = getCondition(op, '');
90
90
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
91
91
  });
92
- it('should reject a string of just whitespace and empty string', function () {
93
- var VALUE = ' ';
94
- var CONDITION = getCondition(op, '');
92
+ it('should reject a string of just whitespace and empty string', () => {
93
+ const VALUE = ' ';
94
+ const CONDITION = getCondition(op, '');
95
95
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
96
96
  });
97
- it("should reject the string number '3' and the number 3", function () {
98
- var VALUE = '3';
99
- var CONDITION = getCondition(op, 3);
97
+ it("should reject the string number '3' and the number 3", () => {
98
+ const VALUE = '3';
99
+ const CONDITION = getCondition(op, 3);
100
100
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
101
101
  });
102
- it('should reject a boolean true and the number 1', function () {
103
- var VALUE = true;
104
- var CONDITION = getCondition(op, 1);
102
+ it('should reject a boolean true and the number 1', () => {
103
+ const VALUE = true;
104
+ const CONDITION = getCondition(op, 1);
105
105
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
106
106
  });
107
- it('should reject a boolean false and a zero', function () {
108
- var VALUE = false;
109
- var CONDITION = getCondition(op, 0);
107
+ it('should reject a boolean false and a zero', () => {
108
+ const VALUE = false;
109
+ const CONDITION = getCondition(op, 0);
110
110
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
111
111
  });
112
112
  });
113
113
  });
114
114
  });
115
- describe('inequality operators', function () {
116
- ['ne', 'neq', '!=', '<>'].forEach(function (op) {
117
- describe("operator ".concat(op), function () {
115
+ describe('inequality operators', () => {
116
+ ['ne', 'neq', '!=', '<>'].forEach(op => {
117
+ describe("operator ".concat(op), () => {
118
118
  // Should reject...
119
- it('should reject two nulls', function () {
120
- var VALUE = null;
121
- var CONDITION = getCondition(op, null);
119
+ it('should reject two nulls', () => {
120
+ const VALUE = null;
121
+ const CONDITION = getCondition(op, null);
122
122
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
123
123
  });
124
- it('should reject two undefineds', function () {
125
- var VALUE = undefined;
126
- var CONDITION = getCondition(op, undefined);
124
+ it('should reject two undefineds', () => {
125
+ const VALUE = undefined;
126
+ const CONDITION = getCondition(op, undefined);
127
127
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
128
128
  });
129
- it('should reject two identical strings', function () {
130
- var VALUE = 'value';
131
- var CONDITION = getCondition(op, 'value');
129
+ it('should reject two identical strings', () => {
130
+ const VALUE = 'value';
131
+ const CONDITION = getCondition(op, 'value');
132
132
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
133
133
  });
134
- it('should reject two empty strings', function () {
135
- var VALUE = '';
136
- var CONDITION = getCondition(op, '');
134
+ it('should reject two empty strings', () => {
135
+ const VALUE = '';
136
+ const CONDITION = getCondition(op, '');
137
137
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
138
138
  });
139
- it('should reject two identical numbers', function () {
140
- var VALUE = 3;
141
- var CONDITION = getCondition(op, 3);
139
+ it('should reject two identical numbers', () => {
140
+ const VALUE = 3;
141
+ const CONDITION = getCondition(op, 3);
142
142
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
143
143
  });
144
- it('should reject two zeroes', function () {
145
- var VALUE = 0;
146
- var CONDITION = getCondition(op, 0);
144
+ it('should reject two zeroes', () => {
145
+ const VALUE = 0;
146
+ const CONDITION = getCondition(op, 0);
147
147
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
148
148
  });
149
- it('should reject two boolean trues', function () {
150
- var VALUE = true;
151
- var CONDITION = getCondition(op, true);
149
+ it('should reject two boolean trues', () => {
150
+ const VALUE = true;
151
+ const CONDITION = getCondition(op, true);
152
152
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
153
153
  });
154
- it('should reject two boolean falses', function () {
155
- var VALUE = false;
156
- var CONDITION = getCondition(op, false);
154
+ it('should reject two boolean falses', () => {
155
+ const VALUE = false;
156
+ const CONDITION = getCondition(op, false);
157
157
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
158
158
  });
159
- it('should reject environmentContext value with data object', function () {
160
- var VALUE = 'Bob';
161
- var DATA = {
159
+ it('should reject environmentContext value with data object', () => {
160
+ const VALUE = 'Bob';
161
+ const DATA = {
162
162
  environmentContext: {
163
163
  currentUser: 'Bob'
164
164
  }
165
165
  };
166
- var CONDITION = getCondition(op, 'field::environmentContext.currentUser');
166
+ const CONDITION = getCondition(op, 'field::environmentContext.currentUser');
167
167
  expect((0, _meetsCondition.default)(CONDITION, VALUE, DATA)).toBeFalsy();
168
168
  });
169
169
 
170
170
  // Should match...
171
- it('should match a null and undefined', function () {
172
- var VALUE = null;
173
- var CONDITION = getCondition(op, undefined);
171
+ it('should match a null and undefined', () => {
172
+ const VALUE = null;
173
+ const CONDITION = getCondition(op, undefined);
174
174
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
175
175
  });
176
- it('should match a null and empty string', function () {
177
- var VALUE = null;
178
- var CONDITION = getCondition(op, '');
176
+ it('should match a null and empty string', () => {
177
+ const VALUE = null;
178
+ const CONDITION = getCondition(op, '');
179
179
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
180
180
  });
181
- it('should match an undefined and empty string', function () {
182
- var VALUE = undefined;
183
- var CONDITION = getCondition(op, '');
181
+ it('should match an undefined and empty string', () => {
182
+ const VALUE = undefined;
183
+ const CONDITION = getCondition(op, '');
184
184
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
185
185
  });
186
- it('should match a string of just whitespace and empty string', function () {
187
- var VALUE = ' ';
188
- var CONDITION = getCondition(op, '');
186
+ it('should match a string of just whitespace and empty string', () => {
187
+ const VALUE = ' ';
188
+ const CONDITION = getCondition(op, '');
189
189
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
190
190
  });
191
- it("should match the string number '3' and the number 3", function () {
192
- var VALUE = '3';
193
- var CONDITION = getCondition(op, 3);
191
+ it("should match the string number '3' and the number 3", () => {
192
+ const VALUE = '3';
193
+ const CONDITION = getCondition(op, 3);
194
194
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
195
195
  });
196
- it('should match a boolean true and the number 1', function () {
197
- var VALUE = true;
198
- var CONDITION = getCondition(op, 1);
196
+ it('should match a boolean true and the number 1', () => {
197
+ const VALUE = true;
198
+ const CONDITION = getCondition(op, 1);
199
199
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
200
200
  });
201
- it('should match a boolean false and a zero', function () {
202
- var VALUE = false;
203
- var CONDITION = getCondition(op, 0);
201
+ it('should match a boolean false and a zero', () => {
202
+ const VALUE = false;
203
+ const CONDITION = getCondition(op, 0);
204
204
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
205
205
  });
206
206
  });
207
207
  });
208
208
  });
209
- describe('operator in', function () {
210
- var op = 'in';
209
+ describe('operator in', () => {
210
+ const op = 'in';
211
211
 
212
212
  // Should match...
213
- it('should match a string that is in the values array', function () {
214
- var VALUE = 'alpha';
215
- var CONDITION = getCondition(op, ['alpha', 'bravo', 'charlie']);
213
+ it('should match a string that is in the values array', () => {
214
+ const VALUE = 'alpha';
215
+ const CONDITION = getCondition(op, ['alpha', 'bravo', 'charlie']);
216
216
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
217
217
  });
218
- it('should match a number that is in the values array', function () {
219
- var VALUE = 4;
220
- var CONDITION = getCondition(op, ['alpha', 'bravo', 'charlie', 4]);
218
+ it('should match a number that is in the values array', () => {
219
+ const VALUE = 4;
220
+ const CONDITION = getCondition(op, ['alpha', 'bravo', 'charlie', 4]);
221
221
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
222
222
  });
223
223
 
224
224
  // Should reject...
225
- it('should reject a string that is missing from the values array', function () {
226
- var VALUE = 'delta';
227
- var CONDITION = getCondition(op, ['alpha', 'bravo', 'charlie']);
225
+ it('should reject a string that is missing from the values array', () => {
226
+ const VALUE = 'delta';
227
+ const CONDITION = getCondition(op, ['alpha', 'bravo', 'charlie']);
228
228
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
229
229
  });
230
- it('should reject a number that is missing from the values array', function () {
231
- var VALUE = 4;
232
- var CONDITION = getCondition(op, ['alpha', 'bravo', 'charlie']);
230
+ it('should reject a number that is missing from the values array', () => {
231
+ const VALUE = 4;
232
+ const CONDITION = getCondition(op, ['alpha', 'bravo', 'charlie']);
233
233
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
234
234
  });
235
- it('should reject everything when the values array is empty', function () {
236
- var CONDITION = getCondition(op, []);
237
- ['a', 'b', 'c', 'd', 'e', 6, 7, 8, 9, 'ten'].forEach(function (value) {
235
+ it('should reject everything when the values array is empty', () => {
236
+ const CONDITION = getCondition(op, []);
237
+ ['a', 'b', 'c', 'd', 'e', 6, 7, 8, 9, 'ten'].forEach(value => {
238
238
  expect((0, _meetsCondition.default)(CONDITION, value)).toBeFalsy();
239
239
  });
240
240
  });
241
- it('should reject everything when the values array is null', function () {
242
- var CONDITION = getCondition(op, null);
243
- ['a', 'b', 'c', 'd', 'e', 6, 7, 8, 9, 'ten'].forEach(function (value) {
241
+ it('should reject everything when the values array is null', () => {
242
+ const CONDITION = getCondition(op, null);
243
+ ['a', 'b', 'c', 'd', 'e', 6, 7, 8, 9, 'ten'].forEach(value => {
244
244
  expect((0, _meetsCondition.default)(CONDITION, value)).toBeFalsy();
245
245
  });
246
246
  });
247
247
  });
248
- describe('operator nin', function () {
249
- var op = 'nin';
248
+ describe('operator nin', () => {
249
+ const op = 'nin';
250
250
 
251
251
  // Should reject...
252
- it('should reject a string that is in the values array', function () {
253
- var VALUE = 'alpha';
254
- var CONDITION = getCondition(op, ['alpha', 'bravo', 'charlie']);
252
+ it('should reject a string that is in the values array', () => {
253
+ const VALUE = 'alpha';
254
+ const CONDITION = getCondition(op, ['alpha', 'bravo', 'charlie']);
255
255
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
256
256
  });
257
- it('should reject a number that is in the values array', function () {
258
- var VALUE = 4;
259
- var CONDITION = getCondition(op, ['alpha', 'bravo', 'charlie', 4]);
257
+ it('should reject a number that is in the values array', () => {
258
+ const VALUE = 4;
259
+ const CONDITION = getCondition(op, ['alpha', 'bravo', 'charlie', 4]);
260
260
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
261
261
  });
262
262
 
263
263
  // Should match...
264
- it('should match a string that is missing from the values array', function () {
265
- var VALUE = 'delta';
266
- var CONDITION = getCondition(op, ['alpha', 'bravo', 'charlie']);
264
+ it('should match a string that is missing from the values array', () => {
265
+ const VALUE = 'delta';
266
+ const CONDITION = getCondition(op, ['alpha', 'bravo', 'charlie']);
267
267
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
268
268
  });
269
- it('should match a number that is missing from the values array', function () {
270
- var VALUE = 4;
271
- var CONDITION = getCondition(op, ['alpha', 'bravo', 'charlie']);
269
+ it('should match a number that is missing from the values array', () => {
270
+ const VALUE = 4;
271
+ const CONDITION = getCondition(op, ['alpha', 'bravo', 'charlie']);
272
272
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
273
273
  });
274
- it('should match anything when the values array is empty', function () {
275
- var CONDITION = getCondition(op, []);
276
- TEST_VALUES.forEach(function (value) {
274
+ it('should match anything when the values array is empty', () => {
275
+ const CONDITION = getCondition(op, []);
276
+ TEST_VALUES.forEach(value => {
277
277
  expect((0, _meetsCondition.default)(CONDITION, value)).toBeTruthy();
278
278
  });
279
279
  });
280
- it('should match anything when the values array is null', function () {
281
- var CONDITION = getCondition(op, null);
282
- TEST_VALUES.forEach(function (value) {
280
+ it('should match anything when the values array is null', () => {
281
+ const CONDITION = getCondition(op, null);
282
+ TEST_VALUES.forEach(value => {
283
283
  expect((0, _meetsCondition.default)(CONDITION, value)).toBeTruthy();
284
284
  });
285
285
  });
286
286
  });
287
- describe('operator contains', function () {
288
- var op = 'contains';
287
+ describe('operator contains', () => {
288
+ const op = 'contains';
289
289
 
290
290
  // Should match...
291
- it('should match a string that is in the field array', function () {
292
- var FIELD = ['alpha', 'bravo', 'charlie'];
293
- var VALUE = 'alpha';
294
- var CONDITION = getCondition(op, VALUE);
291
+ it('should match a string that is in the field array', () => {
292
+ const FIELD = ['alpha', 'bravo', 'charlie'];
293
+ const VALUE = 'alpha';
294
+ const CONDITION = getCondition(op, VALUE);
295
295
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeTruthy();
296
296
  });
297
- it('should match a sub-string that is in the field array', function () {
298
- var FIELD = ['alpha', 'bravo', 'charlie'];
299
- var VALUE = 'alp';
300
- var CONDITION = getCondition(op, VALUE);
297
+ it('should match a sub-string that is in the field array', () => {
298
+ const FIELD = ['alpha', 'bravo', 'charlie'];
299
+ const VALUE = 'alp';
300
+ const CONDITION = getCondition(op, VALUE);
301
301
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeTruthy();
302
302
  });
303
- it('should match a number that is in the field array', function () {
304
- var FIELD = [1, 2, 3];
305
- var VALUE = 1;
306
- var CONDITION = getCondition(op, VALUE);
303
+ it('should match a number that is in the field array', () => {
304
+ const FIELD = [1, 2, 3];
305
+ const VALUE = 1;
306
+ const CONDITION = getCondition(op, VALUE);
307
307
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeTruthy();
308
308
  });
309
- it('should match a sub-string that is in the field string', function () {
310
- var FIELD = 'alphabravocharlie';
311
- var VALUE = 'alpha';
312
- var CONDITION = getCondition(op, VALUE);
309
+ it('should match a sub-string that is in the field string', () => {
310
+ const FIELD = 'alphabravocharlie';
311
+ const VALUE = 'alpha';
312
+ const CONDITION = getCondition(op, VALUE);
313
313
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeTruthy();
314
314
  });
315
- it('should match a string that is in the field array regardless of case', function () {
316
- var FIELD = ['Alpha', 'bravo', 'charlie'];
317
- var VALUE = 'alpha';
318
- var CONDITION = getCondition(op, VALUE);
315
+ it('should match a string that is in the field array regardless of case', () => {
316
+ const FIELD = ['Alpha', 'bravo', 'charlie'];
317
+ const VALUE = 'alpha';
318
+ const CONDITION = getCondition(op, VALUE);
319
319
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeTruthy();
320
320
  });
321
321
 
322
322
  // Should reject...
323
- it('should reject a string that is missing from the field array', function () {
324
- var FIELD = ['alpha', 'bravo', 'charlie'];
325
- var VALUE = 'delta';
326
- var CONDITION = getCondition(op, VALUE);
323
+ it('should reject a string that is missing from the field array', () => {
324
+ const FIELD = ['alpha', 'bravo', 'charlie'];
325
+ const VALUE = 'delta';
326
+ const CONDITION = getCondition(op, VALUE);
327
327
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeFalsy();
328
328
  });
329
- it('should reject a number that is missing from the field array', function () {
330
- var FIELD = [1, 2, 3];
331
- var VALUE = 4;
332
- var CONDITION = getCondition(op, VALUE);
329
+ it('should reject a number that is missing from the field array', () => {
330
+ const FIELD = [1, 2, 3];
331
+ const VALUE = 4;
332
+ const CONDITION = getCondition(op, VALUE);
333
333
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeFalsy();
334
334
  });
335
- it('should reject a substring that is missing from the field string', function () {
336
- var FIELD = 'alphabravocharlie';
337
- var VALUE = 'delta';
338
- var CONDITION = getCondition(op, VALUE);
335
+ it('should reject a substring that is missing from the field string', () => {
336
+ const FIELD = 'alphabravocharlie';
337
+ const VALUE = 'delta';
338
+ const CONDITION = getCondition(op, VALUE);
339
339
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeFalsy();
340
340
  });
341
- it('should reject any value when the field is an empty Array', function () {
342
- var FIELD = [];
343
- var VALUE = 'alpha';
344
- var CONDITION = getCondition(op, VALUE);
341
+ it('should reject any value when the field is an empty Array', () => {
342
+ const FIELD = [];
343
+ const VALUE = 'alpha';
344
+ const CONDITION = getCondition(op, VALUE);
345
345
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeFalsy();
346
346
  });
347
- it('should reject any value when the field is an empty string', function () {
348
- var FIELD = '';
349
- var VALUE = 'alpha';
350
- var CONDITION = getCondition(op, VALUE);
347
+ it('should reject any value when the field is an empty string', () => {
348
+ const FIELD = '';
349
+ const VALUE = 'alpha';
350
+ const CONDITION = getCondition(op, VALUE);
351
351
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeFalsy();
352
352
  });
353
- it('should reject any field when the value is null', function () {
354
- var FIELD = ['alpha', 'bravo', 'charlie'];
355
- var VALUE = null;
356
- var CONDITION = getCondition(op, VALUE);
353
+ it('should reject any field when the value is null', () => {
354
+ const FIELD = ['alpha', 'bravo', 'charlie'];
355
+ const VALUE = null;
356
+ const CONDITION = getCondition(op, VALUE);
357
357
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeFalsy();
358
358
  });
359
- it('should reject any field when the value is undefined', function () {
360
- var FIELD = ['alpha', 'bravo', 'charlie'];
361
- var VALUE = undefined;
362
- var CONDITION = getCondition(op, VALUE);
359
+ it('should reject any field when the value is undefined', () => {
360
+ const FIELD = ['alpha', 'bravo', 'charlie'];
361
+ const VALUE = undefined;
362
+ const CONDITION = getCondition(op, VALUE);
363
363
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeFalsy();
364
364
  });
365
- it('should reject any value when the field is null', function () {
366
- var FIELD = null;
367
- var VALUE = 'alpha';
368
- var CONDITION = getCondition(op, VALUE);
365
+ it('should reject any value when the field is null', () => {
366
+ const FIELD = null;
367
+ const VALUE = 'alpha';
368
+ const CONDITION = getCondition(op, VALUE);
369
369
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeFalsy();
370
370
  });
371
- it('should reject any value when the field is undefined', function () {
372
- var FIELD = undefined;
373
- var VALUE = 'alpha';
374
- var CONDITION = getCondition(op, VALUE);
371
+ it('should reject any value when the field is undefined', () => {
372
+ const FIELD = undefined;
373
+ const VALUE = 'alpha';
374
+ const CONDITION = getCondition(op, VALUE);
375
375
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeFalsy();
376
376
  });
377
377
  });
378
- describe('operator !contains', function () {
379
- var op = '!contains';
378
+ describe('operator !contains', () => {
379
+ const op = '!contains';
380
380
 
381
381
  // Should match...
382
- it('should match a string that is not in the field array', function () {
383
- var FIELD = ['alpha', 'bravo', 'charlie'];
384
- var VALUE = 'delta';
385
- var CONDITION = getCondition(op, VALUE);
382
+ it('should match a string that is not in the field array', () => {
383
+ const FIELD = ['alpha', 'bravo', 'charlie'];
384
+ const VALUE = 'delta';
385
+ const CONDITION = getCondition(op, VALUE);
386
386
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeTruthy();
387
387
  });
388
- it('should match any value if the field array is empty', function () {
389
- var FIELD = [];
390
- var VALUE = 'alpha';
391
- var CONDITION = getCondition(op, VALUE);
388
+ it('should match any value if the field array is empty', () => {
389
+ const FIELD = [];
390
+ const VALUE = 'alpha';
391
+ const CONDITION = getCondition(op, VALUE);
392
392
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeTruthy();
393
393
  });
394
- it('should match any field when the value is null', function () {
395
- var FIELD = ['alpha', 'bravo', 'charlie'];
396
- var VALUE = null;
397
- var CONDITION = getCondition(op, VALUE);
394
+ it('should match any field when the value is null', () => {
395
+ const FIELD = ['alpha', 'bravo', 'charlie'];
396
+ const VALUE = null;
397
+ const CONDITION = getCondition(op, VALUE);
398
398
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeTruthy();
399
399
  });
400
- it('should match any field when the value is undefined', function () {
401
- var FIELD = ['alpha', 'bravo', 'charlie'];
402
- var VALUE = undefined;
403
- var CONDITION = getCondition(op, VALUE);
400
+ it('should match any field when the value is undefined', () => {
401
+ const FIELD = ['alpha', 'bravo', 'charlie'];
402
+ const VALUE = undefined;
403
+ const CONDITION = getCondition(op, VALUE);
404
404
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeTruthy();
405
405
  });
406
- it('should match any value when the field is an empty string', function () {
407
- var FIELD = '';
408
- var VALUE = 'alpha';
409
- var CONDITION = getCondition(op, VALUE);
406
+ it('should match any value when the field is an empty string', () => {
407
+ const FIELD = '';
408
+ const VALUE = 'alpha';
409
+ const CONDITION = getCondition(op, VALUE);
410
410
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeTruthy();
411
411
  });
412
- it('should match a number that is missing from the field array', function () {
413
- var FIELD = [1, 2, 3];
414
- var VALUE = 4;
415
- var CONDITION = getCondition(op, VALUE);
412
+ it('should match a number that is missing from the field array', () => {
413
+ const FIELD = [1, 2, 3];
414
+ const VALUE = 4;
415
+ const CONDITION = getCondition(op, VALUE);
416
416
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeTruthy();
417
417
  });
418
- it('should match a substring that is missing from the field string', function () {
419
- var FIELD = 'alphabravocharlie';
420
- var VALUE = 'delta';
421
- var CONDITION = getCondition(op, VALUE);
418
+ it('should match a substring that is missing from the field string', () => {
419
+ const FIELD = 'alphabravocharlie';
420
+ const VALUE = 'delta';
421
+ const CONDITION = getCondition(op, VALUE);
422
422
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeTruthy();
423
423
  });
424
- it('should match any value when the field is null', function () {
425
- var FIELD = null;
426
- var VALUE = 'alpha';
427
- var CONDITION = getCondition(op, VALUE);
424
+ it('should match any value when the field is null', () => {
425
+ const FIELD = null;
426
+ const VALUE = 'alpha';
427
+ const CONDITION = getCondition(op, VALUE);
428
428
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeTruthy();
429
429
  });
430
- it('should match any value when the field is undefined', function () {
431
- var FIELD = undefined;
432
- var VALUE = 'alpha';
433
- var CONDITION = getCondition(op, VALUE);
430
+ it('should match any value when the field is undefined', () => {
431
+ const FIELD = undefined;
432
+ const VALUE = 'alpha';
433
+ const CONDITION = getCondition(op, VALUE);
434
434
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeTruthy();
435
435
  });
436
436
 
437
437
  // Should reject...
438
- it('should reject a string that is in the field array', function () {
439
- var FIELD = ['alpha', 'bravo', 'charlie'];
440
- var VALUE = 'alpha';
441
- var CONDITION = getCondition(op, VALUE);
438
+ it('should reject a string that is in the field array', () => {
439
+ const FIELD = ['alpha', 'bravo', 'charlie'];
440
+ const VALUE = 'alpha';
441
+ const CONDITION = getCondition(op, VALUE);
442
442
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeFalsy();
443
443
  });
444
- it('should reject a sub-string that is in the field array', function () {
445
- var FIELD = ['alpha', 'bravo', 'charlie'];
446
- var VALUE = 'alp';
447
- var CONDITION = getCondition(op, VALUE);
444
+ it('should reject a sub-string that is in the field array', () => {
445
+ const FIELD = ['alpha', 'bravo', 'charlie'];
446
+ const VALUE = 'alp';
447
+ const CONDITION = getCondition(op, VALUE);
448
448
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeFalsy();
449
449
  });
450
- it('should reject a number that is in the field array', function () {
451
- var FIELD = [1, 2, 3];
452
- var VALUE = 1;
453
- var CONDITION = getCondition(op, VALUE);
450
+ it('should reject a number that is in the field array', () => {
451
+ const FIELD = [1, 2, 3];
452
+ const VALUE = 1;
453
+ const CONDITION = getCondition(op, VALUE);
454
454
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeFalsy();
455
455
  });
456
- it('should reject a sub-string that is in the field string', function () {
457
- var FIELD = 'alphabravocharlie';
458
- var VALUE = 'alpha';
459
- var CONDITION = getCondition(op, VALUE);
456
+ it('should reject a sub-string that is in the field string', () => {
457
+ const FIELD = 'alphabravocharlie';
458
+ const VALUE = 'alpha';
459
+ const CONDITION = getCondition(op, VALUE);
460
460
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeFalsy();
461
461
  });
462
- it('should reject a string that is in the field array regardless of case', function () {
463
- var FIELD = ['Alpha', 'bravo', 'charlie'];
464
- var VALUE = 'alpha';
465
- var CONDITION = getCondition(op, VALUE);
462
+ it('should reject a string that is in the field array regardless of case', () => {
463
+ const FIELD = ['Alpha', 'bravo', 'charlie'];
464
+ const VALUE = 'alpha';
465
+ const CONDITION = getCondition(op, VALUE);
466
466
  expect((0, _meetsCondition.default)(CONDITION, FIELD)).toBeFalsy();
467
467
  });
468
468
  });
469
- describe('numerical operators', function () {
470
- it('less than should reject when value is null', function () {
471
- var CONDITION = {
469
+ describe('numerical operators', () => {
470
+ it('less than should reject when value is null', () => {
471
+ const CONDITION = {
472
472
  op: '<',
473
473
  value: '100'
474
474
  };
475
475
  expect((0, _meetsCondition.default)(CONDITION, null)).toBeFalsy();
476
476
  });
477
- it('less than should reject when condition.value is null', function () {
478
- var CONDITION = {
477
+ it('less than should reject when condition.value is null', () => {
478
+ const CONDITION = {
479
479
  op: '<',
480
480
  value: null
481
481
  };
482
482
  expect((0, _meetsCondition.default)(CONDITION, '100')).toBeFalsy();
483
483
  });
484
- it('less than should reject when condition.value and value are null', function () {
485
- var CONDITION = {
484
+ it('less than should reject when condition.value and value are null', () => {
485
+ const CONDITION = {
486
486
  op: '<',
487
487
  value: null
488
488
  };
489
489
  expect((0, _meetsCondition.default)(CONDITION, null)).toBeFalsy();
490
490
  });
491
- it('less than should reject when value is greater than condition.value', function () {
492
- var CONDITION = {
491
+ it('less than should reject when value is greater than condition.value', () => {
492
+ const CONDITION = {
493
493
  op: '<',
494
494
  value: '100'
495
495
  };
496
496
  expect((0, _meetsCondition.default)(CONDITION, '101')).toBeFalsy();
497
497
  });
498
- it('less than should accept when value is less than condition.value', function () {
499
- var CONDITION = {
498
+ it('less than should accept when value is less than condition.value', () => {
499
+ const CONDITION = {
500
500
  op: '<',
501
501
  value: '100'
502
502
  };
503
503
  expect((0, _meetsCondition.default)(CONDITION, '99')).toBeTruthy();
504
504
  });
505
- it('less than should handle values with commas in', function () {
506
- var CONDITION = {
505
+ it('less than should handle values with commas in', () => {
506
+ const CONDITION = {
507
507
  op: '<',
508
508
  value: '10,000'
509
509
  };
510
510
  expect((0, _meetsCondition.default)(CONDITION, '9,999')).toBeTruthy();
511
511
  });
512
- it('greater than should reject when value is null', function () {
513
- var CONDITION = {
512
+ it('greater than should reject when value is null', () => {
513
+ const CONDITION = {
514
514
  op: '>',
515
515
  value: '100'
516
516
  };
517
517
  expect((0, _meetsCondition.default)(CONDITION, null)).toBeFalsy();
518
518
  });
519
- it('greater than should reject when condition.value is null', function () {
520
- var CONDITION = {
519
+ it('greater than should reject when condition.value is null', () => {
520
+ const CONDITION = {
521
521
  op: '>',
522
522
  value: null
523
523
  };
524
524
  expect((0, _meetsCondition.default)(CONDITION, '100')).toBeFalsy();
525
525
  });
526
- it('greater than should reject when condition.value and value are null', function () {
527
- var CONDITION = {
526
+ it('greater than should reject when condition.value and value are null', () => {
527
+ const CONDITION = {
528
528
  op: '>',
529
529
  value: null
530
530
  };
531
531
  expect((0, _meetsCondition.default)(CONDITION, null)).toBeFalsy();
532
532
  });
533
- it('greater than should reject when value is less than condition.value', function () {
534
- var CONDITION = {
533
+ it('greater than should reject when value is less than condition.value', () => {
534
+ const CONDITION = {
535
535
  op: '>',
536
536
  value: '100'
537
537
  };
538
538
  expect((0, _meetsCondition.default)(CONDITION, '99')).toBeFalsy();
539
539
  });
540
- it('greater than should accept when value is greater than condition.value', function () {
541
- var CONDITION = {
540
+ it('greater than should accept when value is greater than condition.value', () => {
541
+ const CONDITION = {
542
542
  op: '>',
543
543
  value: '100'
544
544
  };
545
545
  expect((0, _meetsCondition.default)(CONDITION, '101')).toBeTruthy();
546
546
  });
547
- it('greater than should handle values with commas in', function () {
548
- var CONDITION = {
547
+ it('greater than should handle values with commas in', () => {
548
+ const CONDITION = {
549
549
  op: '>',
550
550
  value: '10,000'
551
551
  };
552
552
  expect((0, _meetsCondition.default)(CONDITION, '10,000,000')).toBeTruthy();
553
553
  });
554
554
  });
555
- describe('operator includes', function () {
556
- it('should accept a string that exists within the value', function () {
557
- var VALUE = ['red', 'green', 'blue'];
558
- var CONDITION = {
555
+ describe('operator includes', () => {
556
+ it('should accept a string that exists within the value', () => {
557
+ const VALUE = ['red', 'green', 'blue'];
558
+ const CONDITION = {
559
559
  op: 'includes',
560
560
  value: 'blue'
561
561
  };
562
562
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
563
563
  });
564
- it('should accept a number that exists within the value', function () {
565
- var VALUE = [4, 5, 6];
566
- var CONDITION = {
564
+ it('should accept a number that exists within the value', () => {
565
+ const VALUE = [4, 5, 6];
566
+ const CONDITION = {
567
567
  op: 'includes',
568
568
  value: 6
569
569
  };
570
570
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
571
571
  });
572
- it('should reject a string that doesnt exist within the value', function () {
573
- var VALUE = ['red', 'green', 'blue'];
574
- var CONDITION = {
572
+ it('should reject a string that doesnt exist within the value', () => {
573
+ const VALUE = ['red', 'green', 'blue'];
574
+ const CONDITION = {
575
575
  op: 'includes',
576
576
  value: 'purple'
577
577
  };
578
578
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
579
579
  });
580
- it('should reject a number that doesnt exist within the value', function () {
581
- var VALUE = [4, 5, 6];
582
- var CONDITION = {
580
+ it('should reject a number that doesnt exist within the value', () => {
581
+ const VALUE = [4, 5, 6];
582
+ const CONDITION = {
583
583
  op: 'includes',
584
584
  value: 7
585
585
  };
586
586
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
587
587
  });
588
- it('should reject a value that is not an array', function () {
589
- var VALUE = 'badValue';
590
- var CONDITION = {
588
+ it('should reject a value that is not an array', () => {
589
+ const VALUE = 'badValue';
590
+ const CONDITION = {
591
591
  op: 'includes',
592
592
  value: 7
593
593
  };
594
594
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
595
595
  });
596
- it('should reject an empty array', function () {
597
- var VALUE = [];
598
- var CONDITION = {
596
+ it('should reject an empty array', () => {
597
+ const VALUE = [];
598
+ const CONDITION = {
599
599
  op: 'includes',
600
600
  value: 7
601
601
  };
602
602
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
603
603
  });
604
604
  });
605
- describe('operator !includes', function () {
606
- it('should reject a string that exists within the value', function () {
607
- var VALUE = ['red', 'green', 'blue'];
608
- var CONDITION = {
605
+ describe('operator !includes', () => {
606
+ it('should reject a string that exists within the value', () => {
607
+ const VALUE = ['red', 'green', 'blue'];
608
+ const CONDITION = {
609
609
  op: '!includes',
610
610
  value: 'blue'
611
611
  };
612
612
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
613
613
  });
614
- it('should reject a number that exists within the value', function () {
615
- var VALUE = [4, 5, 6];
616
- var CONDITION = {
614
+ it('should reject a number that exists within the value', () => {
615
+ const VALUE = [4, 5, 6];
616
+ const CONDITION = {
617
617
  op: '!includes',
618
618
  value: 6
619
619
  };
620
620
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
621
621
  });
622
- it('should accept a string that doesnt exist within the value', function () {
623
- var VALUE = ['red', 'green', 'blue'];
624
- var CONDITION = {
622
+ it('should accept a string that doesnt exist within the value', () => {
623
+ const VALUE = ['red', 'green', 'blue'];
624
+ const CONDITION = {
625
625
  op: '!includes',
626
626
  value: 'purple'
627
627
  };
628
628
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
629
629
  });
630
- it('should accept a number that doesnt exist within the value', function () {
631
- var VALUE = [4, 5, 6];
632
- var CONDITION = {
630
+ it('should accept a number that doesnt exist within the value', () => {
631
+ const VALUE = [4, 5, 6];
632
+ const CONDITION = {
633
633
  op: '!includes',
634
634
  value: 7
635
635
  };
636
636
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
637
637
  });
638
- it('should accept a value that is not an array', function () {
639
- var VALUE = 'badValue';
640
- var CONDITION = {
638
+ it('should accept a value that is not an array', () => {
639
+ const VALUE = 'badValue';
640
+ const CONDITION = {
641
641
  op: '!includes',
642
642
  value: 7
643
643
  };
644
644
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
645
645
  });
646
- it('should accept an empty array', function () {
647
- var VALUE = [];
648
- var CONDITION = {
646
+ it('should accept an empty array', () => {
647
+ const VALUE = [];
648
+ const CONDITION = {
649
649
  op: '!includes',
650
650
  value: 7
651
651
  };
652
652
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
653
653
  });
654
654
  });
655
- describe('operator includesAllOf', function () {
656
- it('should reject when value is not an array', function () {
657
- var VALUE = 'Not an array';
658
- var CONDITION = {
655
+ describe('operator includesObjectProp', () => {
656
+ it('should accept a property that exists within one of the objects in the value', () => {
657
+ const VALUE = [{
658
+ id: 1
659
+ }, {
660
+ id: 2
661
+ }, {
662
+ id: 3
663
+ }];
664
+ const CONDITION = {
665
+ op: 'includesObjectProp',
666
+ key: 'id',
667
+ value: 2
668
+ };
669
+ expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
670
+ });
671
+ it('should reject a property that doesnt exist within one of the objects in the value', () => {
672
+ const VALUE = [{
673
+ id: 1
674
+ }, {
675
+ id: 2
676
+ }, {
677
+ id: 3
678
+ }];
679
+ const CONDITION = {
680
+ op: 'includesObjectProp',
681
+ key: 'id',
682
+ value: 4
683
+ };
684
+ expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
685
+ });
686
+ it('should reject a value that is not an array', () => {
687
+ const VALUE = 'badValue';
688
+ const CONDITION = {
689
+ op: 'includesObjectProp',
690
+ key: 'id',
691
+ value: 7
692
+ };
693
+ expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
694
+ });
695
+ it('should reject an empty array', () => {
696
+ const VALUE = [];
697
+ const CONDITION = {
698
+ op: 'includesObjectProp',
699
+ key: 'id',
700
+ value: 7
701
+ };
702
+ expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
703
+ });
704
+ });
705
+ describe('operator !includesObjectProp', () => {
706
+ it('should reject a property that exists within one of the objects in the value', () => {
707
+ const VALUE = [{
708
+ id: 1
709
+ }, {
710
+ id: 2
711
+ }, {
712
+ id: 3
713
+ }];
714
+ const CONDITION = {
715
+ op: '!includesObjectProp',
716
+ key: 'id',
717
+ value: 2
718
+ };
719
+ expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
720
+ });
721
+ it('should accept a property that doesnt exist within one of the objects in the value', () => {
722
+ const VALUE = [{
723
+ id: 1
724
+ }, {
725
+ id: 2
726
+ }, {
727
+ id: 3
728
+ }];
729
+ const CONDITION = {
730
+ op: '!includesObjectProp',
731
+ key: 'id',
732
+ value: 4
733
+ };
734
+ expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
735
+ });
736
+ it('should accept a value that is not an array', () => {
737
+ const VALUE = 'badValue';
738
+ const CONDITION = {
739
+ op: '!includesObjectProp',
740
+ key: 'id',
741
+ value: 7
742
+ };
743
+ expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
744
+ });
745
+ it('should accept an empty array', () => {
746
+ const VALUE = [];
747
+ const CONDITION = {
748
+ op: '!includesObjectProp',
749
+ key: 'id',
750
+ value: 7
751
+ };
752
+ expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
753
+ });
754
+ });
755
+ describe('operator includesAllOf', () => {
756
+ it('should reject when value is not an array', () => {
757
+ const VALUE = 'Not an array';
758
+ const CONDITION = {
659
759
  op: 'includesAllOf',
660
760
  values: ['a', 'c']
661
761
  };
662
762
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
663
763
  });
664
- it('should reject when value is an empty array', function () {
665
- var VALUE = [];
666
- var CONDITION = {
764
+ it('should reject when value is an empty array', () => {
765
+ const VALUE = [];
766
+ const CONDITION = {
667
767
  op: 'includesAllOf',
668
768
  values: ['a', 'c']
669
769
  };
670
770
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
671
771
  });
672
- it('should accept when the list of values is an empty array', function () {
673
- var VALUE = ['a', 'b', 'c'];
674
- var CONDITION = {
772
+ it('should accept when the list of values is an empty array', () => {
773
+ const VALUE = ['a', 'b', 'c'];
774
+ const CONDITION = {
675
775
  op: 'includesAllOf',
676
776
  values: []
677
777
  };
678
778
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
679
779
  });
680
- it('should accept a list of values that are all in field', function () {
681
- var VALUE = ['a', 'b', 'c'];
682
- var CONDITION = {
780
+ it('should accept a list of values that are all in field', () => {
781
+ const VALUE = ['a', 'b', 'c'];
782
+ const CONDITION = {
683
783
  op: 'includesAllOf',
684
784
  values: ['a', 'c']
685
785
  };
686
786
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
687
787
  });
688
- it('should reject a list of values if any are missing from field', function () {
689
- var VALUE = ['a', 'b', 'c'];
690
- var CONDITION = {
788
+ it('should reject a list of values if any are missing from field', () => {
789
+ const VALUE = ['a', 'b', 'c'];
790
+ const CONDITION = {
691
791
  op: 'includesAllOf',
692
792
  values: ['a', 'd']
693
793
  };
694
794
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
695
795
  });
696
796
  });
697
- describe('operator !includesAllOf', function () {
698
- it('should accept when value is not an array', function () {
699
- var VALUE = 'Not an array';
700
- var CONDITION = {
797
+ describe('operator !includesAllOf', () => {
798
+ it('should accept when value is not an array', () => {
799
+ const VALUE = 'Not an array';
800
+ const CONDITION = {
701
801
  op: '!includesAllOf',
702
802
  values: ['a', 'c']
703
803
  };
704
804
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
705
805
  });
706
- it('should accept when value is an empty array', function () {
707
- var VALUE = [];
708
- var CONDITION = {
806
+ it('should accept when value is an empty array', () => {
807
+ const VALUE = [];
808
+ const CONDITION = {
709
809
  op: '!includesAllOf',
710
810
  values: ['a', 'c']
711
811
  };
712
812
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
713
813
  });
714
- it('should reject when the list of values is an empty array', function () {
715
- var VALUE = ['a', 'b', 'c'];
716
- var CONDITION = {
814
+ it('should reject when the list of values is an empty array', () => {
815
+ const VALUE = ['a', 'b', 'c'];
816
+ const CONDITION = {
717
817
  op: '!includesAllOf',
718
818
  values: []
719
819
  };
720
820
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
721
821
  });
722
- it('should reject a list of values that are all in value', function () {
723
- var VALUE = ['a', 'b', 'c'];
724
- var CONDITION = {
822
+ it('should reject a list of values that are all in value', () => {
823
+ const VALUE = ['a', 'b', 'c'];
824
+ const CONDITION = {
725
825
  op: '!includesAllOf',
726
826
  values: ['a', 'c']
727
827
  };
728
828
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeFalsy();
729
829
  });
730
- it('should accept a list of values if any are missing from value', function () {
731
- var VALUE = ['a', 'b', 'c'];
732
- var CONDITION = {
830
+ it('should accept a list of values if any are missing from value', () => {
831
+ const VALUE = ['a', 'b', 'c'];
832
+ const CONDITION = {
733
833
  op: '!includesAllOf',
734
834
  values: ['a', 'd']
735
835
  };
736
836
  expect((0, _meetsCondition.default)(CONDITION, VALUE)).toBeTruthy();
737
837
  });
738
838
  });
739
- describe('unknown operator', function () {
740
- var op = 'definitely_not_a_real_operator';
741
- it('should reject anything regardless of the value', function () {
742
- var CONDITION = getCondition(op, 'a');
743
- TEST_VALUES.forEach(function (value) {
839
+ describe('unknown operator', () => {
840
+ const op = 'definitely_not_a_real_operator';
841
+ it('should reject anything regardless of the value', () => {
842
+ const CONDITION = getCondition(op, 'a');
843
+ TEST_VALUES.forEach(value => {
744
844
  expect((0, _meetsCondition.default)(CONDITION, value)).toBeFalsy();
745
845
  });
746
846
  });
747
- it('should accept anything even with a null value', function () {
748
- var CONDITION = getCondition(op, null);
749
- TEST_VALUES.forEach(function (value) {
847
+ it('should accept anything even with a null value', () => {
848
+ const CONDITION = getCondition(op, null);
849
+ TEST_VALUES.forEach(value => {
750
850
  expect((0, _meetsCondition.default)(CONDITION, value)).toBeFalsy();
751
851
  });
752
852
  });
753
- it('should accept anything even with a undefined value', function () {
754
- var CONDITION = getCondition(op, null);
755
- TEST_VALUES.forEach(function (value) {
853
+ it('should accept anything even with a undefined value', () => {
854
+ const CONDITION = getCondition(op, null);
855
+ TEST_VALUES.forEach(value => {
756
856
  expect((0, _meetsCondition.default)(CONDITION, value)).toBeFalsy();
757
857
  });
758
858
  });
759
859
  });
760
- describe('invalid condition', function () {
761
- it('should accept anything when the condition is null', function () {
762
- TEST_VALUES.forEach(function (value) {
860
+ describe('invalid condition', () => {
861
+ it('should accept anything when the condition is null', () => {
862
+ TEST_VALUES.forEach(value => {
763
863
  expect((0, _meetsCondition.default)(null, value)).toBeTruthy();
764
864
  });
765
865
  });
766
- it('should accept anything when the condition is undefined', function () {
767
- TEST_VALUES.forEach(function (value) {
866
+ it('should accept anything when the condition is undefined', () => {
867
+ TEST_VALUES.forEach(value => {
768
868
  expect((0, _meetsCondition.default)(undefined, value)).toBeTruthy();
769
869
  });
770
870
  });
771
- it('should accept anything when the condition is not an object', function () {
772
- TEST_VALUES.forEach(function (value) {
871
+ it('should accept anything when the condition is not an object', () => {
872
+ TEST_VALUES.forEach(value => {
773
873
  expect((0, _meetsCondition.default)('condition', value)).toBeTruthy();
774
874
  });
775
875
  });