mcdev 5.0.2 → 5.2.0

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 (237) hide show
  1. package/.coverage-comment-template.svelte +177 -161
  2. package/.eslintrc.json +4 -4
  3. package/.github/ISSUE_TEMPLATE/bug.yml +2 -0
  4. package/.github/PULL_REQUEST_TEMPLATE.md +2 -2
  5. package/.github/dependabot.yml +8 -0
  6. package/.github/workflows/coverage-base-update.yml +6 -2
  7. package/.github/workflows/coverage-develop-branch.yml +7 -8
  8. package/.github/workflows/coverage-main-branch.yml +7 -8
  9. package/.github/workflows/coverage.yml +7 -4
  10. package/.husky/post-checkout +4 -2
  11. package/.husky/post-merge +1 -0
  12. package/.vscode/extensions.json +4 -0
  13. package/docs/dist/documentation.md +756 -294
  14. package/lib/Deployer.js +28 -28
  15. package/lib/MetadataTypeDefinitions.js +1 -1
  16. package/lib/MetadataTypeInfo.js +1 -1
  17. package/lib/Retriever.js +1 -1
  18. package/lib/cli.js +184 -6
  19. package/lib/index.js +493 -22
  20. package/lib/metadataTypes/Asset.js +10 -11
  21. package/lib/metadataTypes/AttributeGroup.js +76 -2
  22. package/lib/metadataTypes/AttributeSet.js +260 -0
  23. package/lib/metadataTypes/Automation.js +771 -247
  24. package/lib/metadataTypes/DataExtension.js +7 -7
  25. package/lib/metadataTypes/DataExtensionField.js +1 -1
  26. package/lib/metadataTypes/Event.js +2 -3
  27. package/lib/metadataTypes/Folder.js +1 -1
  28. package/lib/metadataTypes/Journey.js +5 -6
  29. package/lib/metadataTypes/MetadataType.js +187 -60
  30. package/lib/metadataTypes/MobileKeyword.js +8 -8
  31. package/lib/metadataTypes/MobileMessage.js +5 -5
  32. package/lib/metadataTypes/Query.js +47 -5
  33. package/lib/metadataTypes/Script.js +3 -3
  34. package/lib/metadataTypes/TransactionalSMS.js +5 -5
  35. package/lib/metadataTypes/TriggeredSend.js +25 -50
  36. package/lib/metadataTypes/User.js +7 -4
  37. package/lib/metadataTypes/definitions/Asset.definition.js +1 -0
  38. package/lib/metadataTypes/definitions/AttributeGroup.definition.js +117 -106
  39. package/lib/metadataTypes/definitions/{SetDefinition.definition.js → AttributeSet.definition.js} +54 -27
  40. package/lib/metadataTypes/definitions/Automation.definition.js +74 -21
  41. package/lib/metadataTypes/definitions/DataExtension.definition.js +1 -0
  42. package/lib/metadataTypes/definitions/DataExtract.definition.js +1 -0
  43. package/lib/metadataTypes/definitions/EmailSend.definition.js +1 -0
  44. package/lib/metadataTypes/definitions/Event.definition.js +1 -0
  45. package/lib/metadataTypes/definitions/Filter.definition.js +1 -0
  46. package/lib/metadataTypes/definitions/ImportFile.definition.js +37 -6
  47. package/lib/metadataTypes/definitions/MobileKeyword.definition.js +1 -0
  48. package/lib/metadataTypes/definitions/Query.definition.js +1 -0
  49. package/lib/metadataTypes/definitions/Role.definition.js +1 -0
  50. package/lib/metadataTypes/definitions/TriggeredSend.definition.js +2 -0
  51. package/lib/metadataTypes/definitions/User.definition.js +1 -0
  52. package/lib/util/cache.js +9 -4
  53. package/lib/util/cli.js +40 -0
  54. package/lib/util/devops.js +13 -11
  55. package/lib/util/file.js +2 -2
  56. package/lib/util/init.js +84 -0
  57. package/lib/util/util.js +268 -137
  58. package/package.json +11 -11
  59. package/test/general.test.js +26 -0
  60. package/test/mockRoot/.mcdevrc.json +1 -1
  61. package/test/mockRoot/deploy/testInstance/testBU/automation/testExisting_automation.automation-meta.json +52 -0
  62. package/test/mockRoot/deploy/testInstance/testBU/automation/testNew_automation.automation-meta.json +45 -0
  63. package/test/mockRoot/deploy/testInstance/testBU/dataExtract/testExisting_dataExtract.dataExtract-meta.json +35 -0
  64. package/test/mockRoot/deploy/testInstance/testBU/dataExtract/testNew_dataExtract.dataExtract-meta.json +35 -0
  65. package/test/mockRoot/deploy/testInstance/testBU/fileTransfer/testExisting_fileTransfer.fileTransfer-meta.json +17 -0
  66. package/test/mockRoot/deploy/testInstance/testBU/fileTransfer/testNew_fileTransfer.fileTransfer-meta.json +17 -0
  67. package/test/mockRoot/deploy/testInstance/testBU/importFile/testExisting_importFile.importFile-meta.json +29 -0
  68. package/test/mockRoot/deploy/testInstance/testBU/importFile/testNew_importFile.importFile-meta.json +29 -0
  69. package/test/mockRoot/deploy/testInstance/testBU/query/{testExistingQuery.query-meta.json → testExisting_query.query-meta.json} +2 -2
  70. package/test/mockRoot/deploy/testInstance/testBU/query/testExisting_query_fixKeys.query-meta.json +11 -0
  71. package/test/mockRoot/deploy/testInstance/testBU/query/testExisting_query_fixKeys.query-meta.sql +6 -0
  72. package/test/mockRoot/deploy/testInstance/testBU/query/{testNewQuery.query-meta.json → testNew_query.query-meta.json} +2 -2
  73. package/test/mockRoot/deploy/testInstance/testBU/script/testExisting_script.script-meta.json +6 -0
  74. package/test/mockRoot/deploy/testInstance/testBU/script/testExisting_script.script-meta.ssjs +1 -0
  75. package/test/mockRoot/deploy/testInstance/testBU/script/testNew_script.script-meta.json +6 -0
  76. package/test/mockRoot/deploy/testInstance/testBU/script/testNew_script.script-meta.ssjs +1 -0
  77. package/test/mockRoot/deploy/testInstance/testBU/triggeredSend/testExisting_triggeredSend.triggeredSend-meta.json +29 -0
  78. package/test/mockRoot/deploy/testInstance/testBU/triggeredSend/testNew_triggeredSend.triggeredSend-meta.json +29 -0
  79. package/test/resourceFactory.js +132 -24
  80. package/test/resources/1111111/accountUser/retrieve-ActiveFlag=falseANDCustomerKey=testExisting_userANDEmaillike@-response.xml +27 -0
  81. package/test/resources/1111111/accountUser/retrieve-ActiveFlag=falseANDEmaillike@-response.xml +156 -0
  82. package/test/resources/1111111/accountUser/retrieve-ActiveFlag=trueANDEmailisNullORNamelikeapp userANDMustChangePassword=false-response.xml +87 -0
  83. package/test/resources/1111111/accountUser/retrieve-ActiveFlag=trueANDEmaillike@-response.xml +156 -0
  84. package/test/resources/1111111/accountUser/retrieve-CustomerKey=testExisting_userANDActiveFlag=trueANDEmailisNullORNamelikeapp userANDMustChangePassword=false-response.xml +27 -0
  85. package/test/resources/1111111/accountUserAccount/retrieve-AccountUser.AccountUserID=700301950-response.xml +60 -0
  86. package/test/resources/1111111/user/retrieve-expected.md +4 -2
  87. package/test/resources/9999999/attributeGroup/retrieve-expected.json +25 -0
  88. package/test/resources/9999999/attributeSet/retrieve-expected.json +748 -0
  89. package/test/resources/9999999/automation/build-expected.json +57 -0
  90. package/test/resources/9999999/automation/create-expected.json +45 -0
  91. package/test/resources/9999999/automation/create-testNew_automation-expected.md +28 -0
  92. package/test/resources/9999999/automation/delete-response.xml +40 -0
  93. package/test/resources/9999999/automation/patch_fixKeys-pause-expected.json +44 -0
  94. package/test/resources/9999999/automation/patch_fixKeys-schedule-expected.json +44 -0
  95. package/test/resources/9999999/automation/perform-08afb0e2-b00a-4c88-ad2e-1f7f8788c560-response.xml +42 -0
  96. package/test/resources/9999999/automation/perform-08afb0e2-b00a-4c88-fixKey_pause-response.xml +42 -0
  97. package/test/resources/9999999/automation/perform-08afb0e2-b00a-4c88-fixKey_schedule-response.xml +42 -0
  98. package/test/resources/9999999/automation/perform-a8afb0e2-b00a-4c88-ad2e-1f7f8788c560-response.xml +42 -0
  99. package/test/resources/9999999/automation/retrieve-expected.json +57 -0
  100. package/test/resources/9999999/automation/retrieve-testExisting_automation-expected.md +30 -0
  101. package/test/resources/9999999/automation/schedule-08afb0e2-b00a-4c88-ad2e-1f7f8788c560-response.xml +52 -0
  102. package/test/resources/9999999/automation/schedule-08afb0e2-b00a-4c88-ad2e-pause-response.xml +38 -0
  103. package/test/resources/9999999/automation/schedule-08afb0e2-b00a-4c88-fixKey_pause-response.xml +52 -0
  104. package/test/resources/9999999/automation/schedule-08afb0e2-b00a-4c88-fixKey_schedule-response.xml +52 -0
  105. package/test/resources/9999999/automation/schedule-a8afb0e2-b00a-4c88-ad2e-1f7f8788c560-response.xml +52 -0
  106. package/test/resources/9999999/automation/template-expected.json +57 -0
  107. package/test/resources/9999999/automation/update-expected.json +45 -0
  108. package/test/resources/9999999/automation/update-testExisting_automation-expected.md +28 -0
  109. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-1f7f8788c560/get-response.json +85 -0
  110. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-1f7f8788c560/patch-response.json +85 -0
  111. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-pause/get-response.json +85 -0
  112. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-pause/patch-response.json +85 -0
  113. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-fixKey_pause/get-response.json +85 -0
  114. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-fixKey_pause/patch-response.json +85 -0
  115. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-fixKey_schedule/get-response.json +85 -0
  116. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-fixKey_schedule/patch-response.json +85 -0
  117. package/test/resources/9999999/automation/v1/automations/a8afb0e2-b00a-4c88-ad2e-1f7f8788c560/get-response.json +85 -0
  118. package/test/resources/9999999/automation/v1/automations/post-response.json +86 -0
  119. package/test/resources/9999999/automation/v1/dataextracts/56c5370a-f988-4f36-b0ee-0f876573f6d7/get-response.json +38 -0
  120. package/test/resources/9999999/automation/v1/dataextracts/56c5370a-f988-4f36-b0ee-0f876573f6d7/patch-response.json +38 -0
  121. package/test/resources/9999999/automation/v1/dataextracts/get-response.json +20 -0
  122. package/test/resources/9999999/automation/v1/dataextracts/post-response.json +38 -0
  123. package/test/resources/9999999/automation/v1/dataextracttypes/get-response.json +50 -0
  124. package/test/resources/9999999/automation/v1/filetransfers/72c328ac-f5b0-4e37-91d3-a775666f15a6/get-response.json +18 -0
  125. package/test/resources/9999999/automation/v1/filetransfers/72c328ac-f5b0-4e37-91d3-a775666f15a6/patch-response.json +18 -0
  126. package/test/resources/9999999/automation/v1/filetransfers/get-response.json +15 -0
  127. package/test/resources/9999999/automation/v1/filetransfers/post-response.json +18 -0
  128. package/test/resources/9999999/automation/v1/ftplocations/get-response.json +18 -0
  129. package/test/resources/9999999/automation/v1/imports/9d16f42c-2260-ed11-b849-48df37d1de8b/patch-response.json +31 -0
  130. package/test/resources/9999999/automation/v1/imports/get-response.json +38 -0
  131. package/test/resources/9999999/automation/v1/imports/post-response.json +30 -0
  132. package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dae/actions/start/post-response.txt +1 -0
  133. package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/actions/start/post-response.txt +1 -0
  134. package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/get-response.json +2 -2
  135. package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/patch-response.json +2 -2
  136. package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat_fixKeys/get-response.json +17 -0
  137. package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat_fixKeys/patch-response.json +18 -0
  138. package/test/resources/9999999/automation/v1/queries/get-response.json +22 -5
  139. package/test/resources/9999999/automation/v1/queries/post-response.json +2 -2
  140. package/test/resources/9999999/automation/v1/scripts/39f6a488-20eb-4ba0-b0b9-023725b574e4/patch-response.json +10 -0
  141. package/test/resources/9999999/automation/v1/scripts/get-response.json +27 -0
  142. package/test/resources/9999999/automation/v1/scripts/post-response.json +10 -0
  143. package/test/resources/9999999/dataExtension/retrieve-Name=testExisting_dataExtension-response.xml +52 -0
  144. package/test/resources/9999999/dataExtensionField/retrieve-DataExtension.CustomerKey=testExisting_dataExtension-response.xml +98 -0
  145. package/test/resources/9999999/dataExtensionField/retrieve-DataExtension.CustomerKey=testNew_dataExtensionORDataExtension.CustomerKey=testExisting_dataExtension-response.xml +99 -0
  146. package/test/resources/9999999/dataExtract/build-expected.json +35 -0
  147. package/test/resources/9999999/dataExtract/get-expected.json +39 -0
  148. package/test/resources/9999999/dataExtract/patch-expected.json +37 -0
  149. package/test/resources/9999999/dataExtract/post-expected.json +37 -0
  150. package/test/resources/9999999/dataExtract/template-expected.json +35 -0
  151. package/test/resources/9999999/dataFolder/retrieve-ContentType=automations-response.xml +48 -0
  152. package/test/resources/9999999/dataFolder/retrieve-ContentType=contextual_suppression_listORContentType=publicationORContentType=suppression_listORContentType=mysubsORContentType=list-response.xml +136 -0
  153. package/test/resources/9999999/dataFolder/retrieve-ContentType=queryactivity-response.xml +48 -0
  154. package/test/resources/9999999/dataFolder/retrieve-ContentType=ssjsactivity-response.xml +48 -0
  155. package/test/resources/9999999/dataFolder/retrieve-ContentType=triggered_send_journeybuilderORContentType=triggered_sendORContentType=hidden-response.xml +276 -0
  156. package/test/resources/9999999/dataFolder/retrieve-response.xml +45 -0
  157. package/test/resources/9999999/email/retrieve-response.xml +203 -0
  158. package/test/resources/9999999/emailSendDefinition/retrieve-IsPlatformObject=falseANDDescriptionnotEqualsSFSendDefinition-response.xml +85 -0
  159. package/test/resources/9999999/fileTransfer/build-expected.json +15 -0
  160. package/test/resources/9999999/fileTransfer/get-expected.json +17 -0
  161. package/test/resources/9999999/fileTransfer/patch-expected.json +17 -0
  162. package/test/resources/9999999/fileTransfer/post-expected.json +17 -0
  163. package/test/resources/9999999/fileTransfer/template-expected.json +15 -0
  164. package/test/resources/9999999/hub/v1/contacts/schema/attributeGroups/get-response.json +585 -0
  165. package/test/resources/9999999/hub/v1/contacts/schema/setDefinitions/get-response.json +19807 -0
  166. package/test/resources/9999999/importFile/build-expected.json +27 -0
  167. package/test/resources/9999999/importFile/get-expected.json +29 -0
  168. package/test/resources/9999999/importFile/patch-expected.json +29 -0
  169. package/test/resources/9999999/importFile/post-expected.json +29 -0
  170. package/test/resources/9999999/importFile/template-expected.json +27 -0
  171. package/test/resources/9999999/legacy/v1/beta/automations/notifications/RkpOcE9qSVh2VUdnYTVJbWFfWW14dzoyNTow/get-response.json +21 -0
  172. package/test/resources/9999999/legacy/v1/beta/automations/notifications/RkpOcE9qSVh2VUdnYTVJbWFfWW14dzoyNTow/post-response.json +0 -0
  173. package/test/resources/9999999/legacy/v1/beta/bulk/automations/automation/definition/get-response.json +30 -0
  174. package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation-response.xml +30 -0
  175. package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation_fixKey_pause-response.xml +32 -0
  176. package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation_fixKey_schedule-response.xml +32 -0
  177. package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation_fixedKey_paused-response.xml +32 -0
  178. package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation_fixedKey_scheduled-response.xml +32 -0
  179. package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation_pause-response.xml +30 -0
  180. package/test/resources/9999999/program/retrieve-CustomerKey=testNew_automation-response.xml +30 -0
  181. package/test/resources/9999999/program/retrieve-Name=testExisting_automation-response.xml +31 -0
  182. package/test/resources/9999999/program/retrieve-response.xml +50 -0
  183. package/test/resources/9999999/query/build-expected.json +2 -2
  184. package/test/resources/9999999/query/get-expected.json +2 -2
  185. package/test/resources/9999999/query/get2-expected.json +2 -2
  186. package/test/resources/9999999/query/patch-expected.json +2 -2
  187. package/test/resources/9999999/query/patch_fixKeys-expected.json +11 -0
  188. package/test/resources/9999999/query/patch_fixKeys-expected.sql +6 -0
  189. package/test/resources/9999999/query/post-expected.json +2 -2
  190. package/test/resources/9999999/query/template-expected.json +2 -2
  191. package/test/resources/9999999/queryDefinition/retrieve-CustomerKey=testExisting_query_fixKeysANDStatus=Active-response.xml +30 -0
  192. package/test/resources/9999999/queryDefinition/retrieve-CustomerKey=testExisting_query_fixedKeysANDStatus=Active-response.xml +30 -0
  193. package/test/resources/9999999/queryDefinition/retrieve-CustomerKey=testNew_queryANDStatus=Active-response.xml +30 -0
  194. package/test/resources/9999999/script/build-expected.json +6 -0
  195. package/test/resources/9999999/script/build-expected.ssjs +1 -0
  196. package/test/resources/9999999/script/get-expected.json +8 -0
  197. package/test/resources/9999999/script/get-expected.ssjs +1 -0
  198. package/test/resources/9999999/script/get_noScriptTag-expected.html +1 -0
  199. package/test/resources/9999999/script/get_noScriptTag-expected.json +8 -0
  200. package/test/resources/9999999/script/patch-expected.json +8 -0
  201. package/test/resources/9999999/script/patch-expected.ssjs +1 -0
  202. package/test/resources/9999999/script/post-expected.json +8 -0
  203. package/test/resources/9999999/script/post-expected.ssjs +1 -0
  204. package/test/resources/9999999/script/template-expected.json +6 -0
  205. package/test/resources/9999999/script/template-expected.ssjs +1 -0
  206. package/test/resources/9999999/triggeredSend/build-expected.json +29 -0
  207. package/test/resources/9999999/triggeredSend/get-expected.json +29 -0
  208. package/test/resources/9999999/triggeredSend/patch-expected.json +29 -0
  209. package/test/resources/9999999/triggeredSend/post-expected.json +29 -0
  210. package/test/resources/9999999/triggeredSend/template-expected.json +29 -0
  211. package/test/resources/9999999/triggeredSendDefinition/create-response.xml +75 -0
  212. package/test/resources/9999999/triggeredSendDefinition/delete-response.xml +36 -0
  213. package/test/resources/9999999/triggeredSendDefinition/{retrieve-response.xml → retrieve-TriggeredSendStatusINNew,Active,Inactive,Moved,Canceled-response.xml} +4 -4
  214. package/test/resources/9999999/triggeredSendDefinition/update-response.xml +74 -0
  215. package/test/type.attributeGroup.test.js +55 -0
  216. package/test/type.attributeSet.test.js +55 -0
  217. package/test/type.automation.test.js +886 -0
  218. package/test/type.dataExtension.test.js +3 -1
  219. package/test/type.dataExtract.test.js +187 -0
  220. package/test/type.fileTransfer.test.js +185 -0
  221. package/test/type.importFile.test.js +186 -0
  222. package/test/type.mobileKeyword.test.js +0 -1
  223. package/test/type.query.test.js +497 -33
  224. package/test/type.script.test.js +367 -0
  225. package/test/type.triggeredSend.test.js +152 -0
  226. package/test/type.user.test.js +37 -11
  227. package/test/utils.js +10 -6
  228. package/.coverage-comment-template.md +0 -20
  229. package/lib/metadataTypes/SetDefinition.js +0 -37
  230. /package/test/mockRoot/deploy/testInstance/testBU/query/{testExistingQuery.query-meta.sql → testExisting_query.query-meta.sql} +0 -0
  231. /package/test/mockRoot/deploy/testInstance/testBU/query/{testNewQuery.query-meta.sql → testNew_query.query-meta.sql} +0 -0
  232. /package/test/resources/1111111/accountUser/{retrieve-response.xml → retrieve-ActiveFlag=trueANDCustomerKey=testExisting_userANDEmaillike@-response.xml} +0 -0
  233. /package/test/resources/1111111/accountUserAccount/{retrieve-response.xml → retrieve-AccountUser.AccountUserIDIN700301950,700301951,7471228-response.xml} +0 -0
  234. /package/test/resources/1111111/businessUnit/{retrieve-response.xml → retrieve-ID=1111111-response.xml} +0 -0
  235. /package/test/resources/1111111/list/{retrieve-response.xml → retrieve-CustomerKey=All SubscribersORListName=All Subscribers-response.xml} +0 -0
  236. /package/test/resources/1111111/role/{retrieve-response.xml → retrieve-IsPrivate=false-response.xml} +0 -0
  237. /package/test/resources/9999999/queryDefinition/{retrieve-response.xml → retrieve-CustomerKey=testExisting_queryANDStatus=Active-response.xml} +0 -0
@@ -1,5 +1,8 @@
1
1
  const chai = require('chai');
2
2
  const chaiFiles = require('chai-files');
3
+
4
+ chai.use(chaiFiles);
5
+
3
6
  const assert = chai.assert;
4
7
  const expect = chai.expect;
5
8
  const file = chaiFiles.file;
@@ -84,7 +87,6 @@ describe('type: dataExtension', () => {
84
87
  );
85
88
  return;
86
89
  });
87
- it('Should change the key during update via --changeKeyValue');
88
90
  it('Should rename fields');
89
91
  });
90
92
  describe('Templating ================', () => {
@@ -0,0 +1,187 @@
1
+ const chai = require('chai');
2
+ const chaiFiles = require('chai-files');
3
+ const assert = chai.assert;
4
+ chai.use(chaiFiles);
5
+ const cache = require('../lib/util/cache');
6
+ const testUtils = require('./utils');
7
+ const handler = require('../lib/index');
8
+
9
+ describe('type: dataExtract', () => {
10
+ beforeEach(() => {
11
+ testUtils.mockSetup();
12
+ });
13
+ afterEach(() => {
14
+ testUtils.mockReset();
15
+ });
16
+
17
+ describe('Retrieve ================', () => {
18
+ it('Should retrieve a dataExtract', async () => {
19
+ // WHEN
20
+ await handler.retrieve('testInstance/testBU', ['dataExtract']);
21
+ // THEN
22
+ assert.equal(process.exitCode, false, 'retrieve should not have thrown an error');
23
+ // get results from cache
24
+ const result = cache.getCache();
25
+ assert.equal(
26
+ result.dataExtract ? Object.keys(result.dataExtract).length : 0,
27
+ 1,
28
+ 'only one dataExtract expected'
29
+ );
30
+ assert.deepEqual(
31
+ await testUtils.getActualJson('testExisting_dataExtract', 'dataExtract'),
32
+ await testUtils.getExpectedJson('9999999', 'dataExtract', 'get'),
33
+ 'returned JSON was not equal expected'
34
+ );
35
+ assert.equal(
36
+ testUtils.getAPIHistoryLength(),
37
+ 6,
38
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
39
+ );
40
+ return;
41
+ });
42
+ });
43
+ describe('Deploy ================', () => {
44
+ beforeEach(() => {
45
+ testUtils.mockSetup(true);
46
+ });
47
+ it('Should create & upsert a dataExtract', async () => {
48
+ // WHEN
49
+
50
+ await handler.deploy('testInstance/testBU', ['dataExtract']);
51
+ // THEN
52
+ assert.equal(process.exitCode, false, 'deploy should not have thrown an error');
53
+ // get results from cache
54
+ const result = cache.getCache();
55
+ assert.equal(
56
+ result.dataExtract ? Object.keys(result.dataExtract).length : 0,
57
+ 2,
58
+ 'two dataExtracts expected'
59
+ );
60
+ // confirm created item
61
+ assert.deepEqual(
62
+ await testUtils.getActualJson('testNew_dataExtract', 'dataExtract'),
63
+ await testUtils.getExpectedJson('9999999', 'dataExtract', 'post'),
64
+ 'returned new-JSON was not equal expected for insert dataExtract'
65
+ );
66
+ // confirm updated item
67
+ assert.deepEqual(
68
+ await testUtils.getActualJson('testExisting_dataExtract', 'dataExtract'),
69
+ await testUtils.getExpectedJson('9999999', 'dataExtract', 'patch'),
70
+ 'returned existing-JSON was not equal expected for update dataExtract'
71
+ );
72
+ // check number of API calls
73
+ assert.equal(
74
+ testUtils.getAPIHistoryLength(),
75
+ 8,
76
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
77
+ );
78
+ return;
79
+ });
80
+ it('Should change the key during update via --changeKeyValue ');
81
+ });
82
+ describe('Templating ================', () => {
83
+ it('Should create a dataExtract template via retrieveAsTemplate and build it', async () => {
84
+ // buildTemplate
85
+ const result = await handler.retrieveAsTemplate(
86
+ 'testInstance/testBU',
87
+ 'dataExtract',
88
+ ['testExisting_dataExtract'],
89
+ 'testSourceMarket'
90
+ );
91
+ assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error');
92
+ assert.equal(
93
+ result.dataExtract ? Object.keys(result.dataExtract).length : 0,
94
+ 1,
95
+ 'only one dataExtract expected'
96
+ );
97
+ assert.deepEqual(
98
+ await testUtils.getActualTemplateJson('testExisting_dataExtract', 'dataExtract'),
99
+ await testUtils.getExpectedJson('9999999', 'dataExtract', 'template'),
100
+ 'returned template JSON was not equal expected'
101
+ );
102
+ // buildDefinition
103
+ await handler.buildDefinition(
104
+ 'testInstance/testBU',
105
+ 'dataExtract',
106
+ 'testExisting_dataExtract',
107
+ 'testTargetMarket'
108
+ );
109
+ assert.equal(
110
+ process.exitCode,
111
+ false,
112
+ 'buildDefinition should not have thrown an error'
113
+ );
114
+ assert.deepEqual(
115
+ await testUtils.getActualDeployJson('testTemplated_dataExtract', 'dataExtract'),
116
+ await testUtils.getExpectedJson('9999999', 'dataExtract', 'build'),
117
+ 'returned deployment JSON was not equal expected'
118
+ );
119
+ assert.equal(
120
+ testUtils.getAPIHistoryLength(),
121
+ 6,
122
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
123
+ );
124
+ return;
125
+ });
126
+ it('Should create a dataExtract template via buildTemplate and build it', async () => {
127
+ // download first before we test buildTemplate
128
+ await handler.retrieve('testInstance/testBU', ['dataExtract']);
129
+ // buildTemplate
130
+ const result = await handler.buildTemplate(
131
+ 'testInstance/testBU',
132
+ 'dataExtract',
133
+ ['testExisting_dataExtract'],
134
+ 'testSourceMarket'
135
+ );
136
+ assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error');
137
+ assert.equal(
138
+ result.dataExtract ? Object.keys(result.dataExtract).length : 0,
139
+ 1,
140
+ 'only one dataExtract expected'
141
+ );
142
+ assert.deepEqual(
143
+ await testUtils.getActualTemplateJson('testExisting_dataExtract', 'dataExtract'),
144
+ await testUtils.getExpectedJson('9999999', 'dataExtract', 'template'),
145
+ 'returned template JSON was not equal expected'
146
+ );
147
+ // buildDefinition
148
+ await handler.buildDefinition(
149
+ 'testInstance/testBU',
150
+ 'dataExtract',
151
+ 'testExisting_dataExtract',
152
+ 'testTargetMarket'
153
+ );
154
+ assert.equal(
155
+ process.exitCode,
156
+ false,
157
+ 'buildDefinition should not have thrown an error'
158
+ );
159
+ assert.deepEqual(
160
+ await testUtils.getActualDeployJson('testTemplated_dataExtract', 'dataExtract'),
161
+ await testUtils.getExpectedJson('9999999', 'dataExtract', 'build'),
162
+ 'returned deployment JSON was not equal expected'
163
+ );
164
+ assert.equal(
165
+ testUtils.getAPIHistoryLength(),
166
+ 6,
167
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
168
+ );
169
+ return;
170
+ });
171
+ });
172
+ describe('Delete ================', () => {
173
+ it('Should NOT delete the item', async () => {
174
+ // WHEN
175
+ await handler.deleteByKey('testInstance/testBU', 'dataExtract', [
176
+ 'testExisting_fileTranfer',
177
+ ]);
178
+ // THEN
179
+ assert.equal(
180
+ process.exitCode,
181
+ 1,
182
+ 'deleteByKey should have thrown an error due to lack of support'
183
+ );
184
+ return;
185
+ });
186
+ });
187
+ });
@@ -0,0 +1,185 @@
1
+ const chai = require('chai');
2
+ const chaiFiles = require('chai-files');
3
+ const assert = chai.assert;
4
+ chai.use(chaiFiles);
5
+ const cache = require('../lib/util/cache');
6
+ const testUtils = require('./utils');
7
+ const handler = require('../lib/index');
8
+
9
+ describe('type: fileTransfer', () => {
10
+ beforeEach(() => {
11
+ testUtils.mockSetup();
12
+ });
13
+ afterEach(() => {
14
+ testUtils.mockReset();
15
+ });
16
+
17
+ describe('Retrieve ================', () => {
18
+ it('Should retrieve a fileTransfer', async () => {
19
+ // WHEN
20
+ await handler.retrieve('testInstance/testBU', ['fileTransfer']);
21
+ // THEN
22
+ assert.equal(process.exitCode, false, 'retrieve should not have thrown an error');
23
+ // get results from cache
24
+ const result = cache.getCache();
25
+ assert.equal(
26
+ result.fileTransfer ? Object.keys(result.fileTransfer).length : 0,
27
+ 1,
28
+ 'only one fileTransfer expected'
29
+ );
30
+ assert.deepEqual(
31
+ await testUtils.getActualJson('testExisting_fileTransfer', 'fileTransfer'),
32
+ await testUtils.getExpectedJson('9999999', 'fileTransfer', 'get'),
33
+ 'returned JSON was not equal expected'
34
+ );
35
+ assert.equal(
36
+ testUtils.getAPIHistoryLength(),
37
+ 3,
38
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
39
+ );
40
+ return;
41
+ });
42
+ });
43
+ describe('Deploy ================', () => {
44
+ beforeEach(() => {
45
+ testUtils.mockSetup(true);
46
+ });
47
+ it('Should create & upsert a fileTransfer', async () => {
48
+ // WHEN
49
+ await handler.deploy('testInstance/testBU', ['fileTransfer']);
50
+ // THEN
51
+ assert.equal(process.exitCode, false, 'deploy should not have thrown an error');
52
+ // get results from cache
53
+ const result = cache.getCache();
54
+ assert.equal(
55
+ result.fileTransfer ? Object.keys(result.fileTransfer).length : 0,
56
+ 2,
57
+ 'two fileTransfers expected'
58
+ );
59
+ // confirm created item
60
+ assert.deepEqual(
61
+ await testUtils.getActualJson('testNew_fileTransfer', 'fileTransfer'),
62
+ await testUtils.getExpectedJson('9999999', 'fileTransfer', 'post'),
63
+ 'returned JSON was not equal expected for insert fileTransfer'
64
+ );
65
+ // confirm updated item
66
+ assert.deepEqual(
67
+ await testUtils.getActualJson('testExisting_fileTransfer', 'fileTransfer'),
68
+ await testUtils.getExpectedJson('9999999', 'fileTransfer', 'patch'),
69
+ 'returned JSON was not equal expected for update fileTransfer'
70
+ );
71
+ // check number of API calls
72
+ assert.equal(
73
+ testUtils.getAPIHistoryLength(),
74
+ 5,
75
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
76
+ );
77
+ return;
78
+ });
79
+ });
80
+ describe('Templating ================', () => {
81
+ it('Should create a fileTransfer template via retrieveAsTemplate and build it', async () => {
82
+ // buildTemplate
83
+ const result = await handler.retrieveAsTemplate(
84
+ 'testInstance/testBU',
85
+ 'fileTransfer',
86
+ ['testExisting_fileTransfer'],
87
+ 'testSourceMarket'
88
+ );
89
+ assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error');
90
+ assert.equal(
91
+ result.fileTransfer ? Object.keys(result.fileTransfer).length : 0,
92
+ 1,
93
+ 'only one fileTransfer expected'
94
+ );
95
+ assert.deepEqual(
96
+ await testUtils.getActualTemplateJson('testExisting_fileTransfer', 'fileTransfer'),
97
+ await testUtils.getExpectedJson('9999999', 'fileTransfer', 'template'),
98
+ 'returned template JSON was not equal expected'
99
+ );
100
+ // buildDefinition
101
+ await handler.buildDefinition(
102
+ 'testInstance/testBU',
103
+ 'fileTransfer',
104
+ 'testExisting_fileTransfer',
105
+ 'testTargetMarket'
106
+ );
107
+ assert.equal(
108
+ process.exitCode,
109
+ false,
110
+ 'buildDefinition should not have thrown an error'
111
+ );
112
+ assert.deepEqual(
113
+ await testUtils.getActualDeployJson('testTemplated_fileTransfer', 'fileTransfer'),
114
+ await testUtils.getExpectedJson('9999999', 'fileTransfer', 'build'),
115
+ 'returned deployment JSON was not equal expected'
116
+ );
117
+ assert.equal(
118
+ testUtils.getAPIHistoryLength(),
119
+ 3,
120
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
121
+ );
122
+ return;
123
+ });
124
+ it('Should create a fileTransfer template via buildTemplate and build it', async () => {
125
+ // download first before we test buildTemplate
126
+ await handler.retrieve('testInstance/testBU', ['fileTransfer']);
127
+ // buildTemplate
128
+ const result = await handler.buildTemplate(
129
+ 'testInstance/testBU',
130
+ 'fileTransfer',
131
+ ['testExisting_fileTransfer'],
132
+ 'testSourceMarket'
133
+ );
134
+ assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error');
135
+ assert.equal(
136
+ result.fileTransfer ? Object.keys(result.fileTransfer).length : 0,
137
+ 1,
138
+ 'only one fileTransfer expected'
139
+ );
140
+ assert.deepEqual(
141
+ await testUtils.getActualTemplateJson('testExisting_fileTransfer', 'fileTransfer'),
142
+ await testUtils.getExpectedJson('9999999', 'fileTransfer', 'template'),
143
+ 'returned template JSON was not equal expected'
144
+ );
145
+ // buildDefinition
146
+ await handler.buildDefinition(
147
+ 'testInstance/testBU',
148
+ 'fileTransfer',
149
+ 'testExisting_fileTransfer',
150
+ 'testTargetMarket'
151
+ );
152
+ assert.equal(
153
+ process.exitCode,
154
+ false,
155
+ 'buildDefinition should not have thrown an error'
156
+ );
157
+ assert.deepEqual(
158
+ await testUtils.getActualDeployJson('testTemplated_fileTransfer', 'fileTransfer'),
159
+ await testUtils.getExpectedJson('9999999', 'fileTransfer', 'build'),
160
+ 'returned deployment JSON was not equal expected'
161
+ );
162
+ assert.equal(
163
+ testUtils.getAPIHistoryLength(),
164
+ 3,
165
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
166
+ );
167
+ return;
168
+ });
169
+ });
170
+ describe('Delete ================', () => {
171
+ it('Should NOT delete the item', async () => {
172
+ // WHEN
173
+ await handler.deleteByKey('testInstance/testBU', 'fileTransfer', [
174
+ 'testExisting_fileTranfer',
175
+ ]);
176
+ // THEN
177
+ assert.equal(
178
+ process.exitCode,
179
+ 1,
180
+ 'deleteByKey should have thrown an error due to lack of support'
181
+ );
182
+ return;
183
+ });
184
+ });
185
+ });
@@ -0,0 +1,186 @@
1
+ const chai = require('chai');
2
+ const chaiFiles = require('chai-files');
3
+ const assert = chai.assert;
4
+ chai.use(chaiFiles);
5
+ const cache = require('../lib/util/cache');
6
+ const testUtils = require('./utils');
7
+ const handler = require('../lib/index');
8
+
9
+ describe('type: importFile', () => {
10
+ beforeEach(() => {
11
+ testUtils.mockSetup();
12
+ });
13
+ afterEach(() => {
14
+ testUtils.mockReset();
15
+ });
16
+
17
+ describe('Retrieve ================', () => {
18
+ it('Should retrieve a importFile', async () => {
19
+ // WHEN
20
+ await handler.retrieve('testInstance/testBU', ['importFile']);
21
+ // THEN
22
+ assert.equal(process.exitCode, false, 'retrieve should not have thrown an error');
23
+ // get results from cache
24
+ const result = cache.getCache();
25
+ assert.equal(
26
+ result.importFile ? Object.keys(result.importFile).length : 0,
27
+ 1,
28
+ 'only one importFile expected'
29
+ );
30
+ assert.deepEqual(
31
+ await testUtils.getActualJson('testExisting_importFile', 'importFile'),
32
+ await testUtils.getExpectedJson('9999999', 'importFile', 'get'),
33
+ 'returned JSON was not equal expected'
34
+ );
35
+ assert.equal(
36
+ testUtils.getAPIHistoryLength(),
37
+ 10,
38
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
39
+ );
40
+ return;
41
+ });
42
+ });
43
+ describe('Deploy ================', () => {
44
+ beforeEach(() => {
45
+ testUtils.mockSetup(true);
46
+ });
47
+ it('Should create & upsert a importFile', async () => {
48
+ // WHEN
49
+
50
+ await handler.deploy('testInstance/testBU', ['importFile']);
51
+ // THEN
52
+ assert.equal(process.exitCode, false, 'deploy should not have thrown an error');
53
+ // get results from cache
54
+ const result = cache.getCache();
55
+ assert.equal(
56
+ result.importFile ? Object.keys(result.importFile).length : 0,
57
+ 2,
58
+ 'two importFiles expected'
59
+ );
60
+ // confirm created item
61
+ assert.deepEqual(
62
+ await testUtils.getActualJson('testNew_importFile', 'importFile'),
63
+ await testUtils.getExpectedJson('9999999', 'importFile', 'post'),
64
+ 'returned new-JSON was not equal expected for insert importFile'
65
+ );
66
+ // confirm updated item
67
+ assert.deepEqual(
68
+ await testUtils.getActualJson('testExisting_importFile', 'importFile'),
69
+ await testUtils.getExpectedJson('9999999', 'importFile', 'patch'),
70
+ 'returned existing-JSON was not equal expected for update importFile'
71
+ );
72
+ // check number of API calls
73
+ assert.equal(
74
+ testUtils.getAPIHistoryLength(),
75
+ 12,
76
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
77
+ );
78
+ return;
79
+ });
80
+ });
81
+ describe('Templating ================', () => {
82
+ it('Should create a importFile template via retrieveAsTemplate and build it', async () => {
83
+ // buildTemplate
84
+ const result = await handler.retrieveAsTemplate(
85
+ 'testInstance/testBU',
86
+ 'importFile',
87
+ ['testExisting_importFile'],
88
+ 'testSourceMarket'
89
+ );
90
+ assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error');
91
+ assert.equal(
92
+ result.importFile ? Object.keys(result.importFile).length : 0,
93
+ 1,
94
+ 'only one importFile expected'
95
+ );
96
+ assert.deepEqual(
97
+ await testUtils.getActualTemplateJson('testExisting_importFile', 'importFile'),
98
+ await testUtils.getExpectedJson('9999999', 'importFile', 'template'),
99
+ 'returned template JSON was not equal expected'
100
+ );
101
+ // buildDefinition
102
+ await handler.buildDefinition(
103
+ 'testInstance/testBU',
104
+ 'importFile',
105
+ 'testExisting_importFile',
106
+ 'testTargetMarket'
107
+ );
108
+ assert.equal(
109
+ process.exitCode,
110
+ false,
111
+ 'buildDefinition should not have thrown an error'
112
+ );
113
+ assert.deepEqual(
114
+ await testUtils.getActualDeployJson('testTemplated_importFile', 'importFile'),
115
+ await testUtils.getExpectedJson('9999999', 'importFile', 'build'),
116
+ 'returned deployment JSON was not equal expected'
117
+ );
118
+ assert.equal(
119
+ testUtils.getAPIHistoryLength(),
120
+ 10,
121
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
122
+ );
123
+ return;
124
+ });
125
+ it('Should create a importFile template via buildTemplate and build it', async () => {
126
+ // download first before we test buildTemplate
127
+ await handler.retrieve('testInstance/testBU', ['importFile']);
128
+ // buildTemplate
129
+ const result = await handler.buildTemplate(
130
+ 'testInstance/testBU',
131
+ 'importFile',
132
+ ['testExisting_importFile'],
133
+ 'testSourceMarket'
134
+ );
135
+ assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error');
136
+ assert.equal(
137
+ result.importFile ? Object.keys(result.importFile).length : 0,
138
+ 1,
139
+ 'only one importFile expected'
140
+ );
141
+ assert.deepEqual(
142
+ await testUtils.getActualTemplateJson('testExisting_importFile', 'importFile'),
143
+ await testUtils.getExpectedJson('9999999', 'importFile', 'template'),
144
+ 'returned template JSON was not equal expected'
145
+ );
146
+ // buildDefinition
147
+ await handler.buildDefinition(
148
+ 'testInstance/testBU',
149
+ 'importFile',
150
+ 'testExisting_importFile',
151
+ 'testTargetMarket'
152
+ );
153
+ assert.equal(
154
+ process.exitCode,
155
+ false,
156
+ 'buildDefinition should not have thrown an error'
157
+ );
158
+ assert.deepEqual(
159
+ await testUtils.getActualDeployJson('testTemplated_importFile', 'importFile'),
160
+ await testUtils.getExpectedJson('9999999', 'importFile', 'build'),
161
+ 'returned deployment JSON was not equal expected'
162
+ );
163
+ assert.equal(
164
+ testUtils.getAPIHistoryLength(),
165
+ 10,
166
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
167
+ );
168
+ return;
169
+ });
170
+ });
171
+ describe('Delete ================', () => {
172
+ it('Should NOT delete the item', async () => {
173
+ // WHEN
174
+ await handler.deleteByKey('testInstance/testBU', 'importFile', [
175
+ 'testExisting_fileTranfer',
176
+ ]);
177
+ // THEN
178
+ assert.equal(
179
+ process.exitCode,
180
+ 1,
181
+ 'deleteByKey should have thrown an error due to lack of support'
182
+ );
183
+ return;
184
+ });
185
+ });
186
+ });
@@ -120,7 +120,6 @@ describe('type: mobileKeyword', () => {
120
120
  );
121
121
  return;
122
122
  });
123
- it('Should change the key during update via --changeKeyValue');
124
123
  });
125
124
  describe('Templating ================', () => {
126
125
  it('Should create a mobileKeyword template via retrieveAsTemplate and build it', async () => {