mcdev 5.1.0 → 5.3.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.
- package/.eslintrc.json +4 -4
- package/.fork/custom-commands.json +12 -0
- package/.github/ISSUE_TEMPLATE/bug.yml +2 -0
- package/.github/PULL_REQUEST_TEMPLATE/pr_template_release.md +19 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +2 -2
- package/.github/workflows/coverage-develop-branch.yml +0 -2
- package/.github/workflows/coverage-main-branch.yml +0 -2
- package/.github/workflows/coverage.yml +0 -2
- package/.husky/post-checkout +1 -0
- package/.husky/post-merge +1 -0
- package/.vscode/extensions.json +4 -0
- package/docs/dist/documentation.md +1034 -296
- package/lib/Deployer.js +25 -25
- package/lib/MetadataTypeDefinitions.js +2 -1
- package/lib/MetadataTypeInfo.js +2 -1
- package/lib/Retriever.js +1 -1
- package/lib/cli.js +165 -10
- package/lib/index.js +398 -95
- package/lib/metadataTypes/Asset.js +10 -11
- package/lib/metadataTypes/AttributeGroup.js +76 -2
- package/lib/metadataTypes/AttributeSet.js +367 -0
- package/lib/metadataTypes/Automation.js +483 -137
- package/lib/metadataTypes/DataExtension.js +465 -68
- package/lib/metadataTypes/DataExtensionField.js +31 -14
- package/lib/metadataTypes/Event.js +2 -3
- package/lib/metadataTypes/Folder.js +1 -1
- package/lib/metadataTypes/Journey.js +13 -7
- package/lib/metadataTypes/MetadataType.js +212 -54
- package/lib/metadataTypes/MobileKeyword.js +9 -9
- package/lib/metadataTypes/MobileMessage.js +5 -5
- package/lib/metadataTypes/Query.js +26 -10
- package/lib/metadataTypes/Script.js +3 -3
- package/lib/metadataTypes/TransactionalEmail.js +94 -17
- package/lib/metadataTypes/TransactionalMessage.js +3 -2
- package/lib/metadataTypes/TransactionalSMS.js +5 -5
- package/lib/metadataTypes/TriggeredSend.js +25 -50
- package/lib/metadataTypes/User.js +7 -4
- package/lib/metadataTypes/Verification.js +230 -0
- package/lib/metadataTypes/definitions/AttributeGroup.definition.js +119 -108
- package/lib/metadataTypes/definitions/{SetDefinition.definition.js → AttributeSet.definition.js} +123 -43
- package/lib/metadataTypes/definitions/Automation.definition.js +23 -15
- package/lib/metadataTypes/definitions/ImportFile.definition.js +36 -6
- package/lib/metadataTypes/definitions/TransactionalEmail.definition.js +19 -1
- package/lib/metadataTypes/definitions/TriggeredSend.definition.js +1 -0
- package/lib/metadataTypes/definitions/Verification.definition.js +88 -0
- package/lib/util/cache.js +9 -4
- package/lib/util/cli.js +40 -0
- package/lib/util/file.js +2 -2
- package/lib/util/init.js +84 -0
- package/lib/util/util.js +121 -13
- package/package.json +13 -13
- package/test/mockRoot/.mcdevrc.json +1 -1
- package/test/mockRoot/deploy/testInstance/_ParentBU_/dataExtension/testExisting_dataExtensionShared.dataExtension-meta.json +59 -0
- package/test/mockRoot/deploy/testInstance/_ParentBU_/dataExtension/testNew_dataExtensionShared.dataExtension-meta.json +23 -0
- package/test/mockRoot/deploy/testInstance/testBU/automation/testExisting_automation.automation-meta.json +1 -2
- package/test/mockRoot/deploy/testInstance/testBU/automation/testNew_automation.automation-meta.json +9 -6
- package/test/mockRoot/deploy/testInstance/testBU/dataExtension/testExisting_dataExtension.dataExtension-meta.json +1 -0
- package/test/mockRoot/deploy/testInstance/testBU/dataExtract/testExisting_dataExtract.dataExtract-meta.json +35 -0
- package/test/mockRoot/deploy/testInstance/testBU/dataExtract/testNew_dataExtract.dataExtract-meta.json +35 -0
- package/test/mockRoot/deploy/testInstance/testBU/fileTransfer/testExisting_fileTransfer.fileTransfer-meta.json +17 -0
- package/test/mockRoot/deploy/testInstance/testBU/fileTransfer/testNew_fileTransfer.fileTransfer-meta.json +17 -0
- package/test/mockRoot/deploy/testInstance/testBU/importFile/testExisting_importFile.importFile-meta.json +29 -0
- package/test/mockRoot/deploy/testInstance/testBU/importFile/testNew_importFile.importFile-meta.json +29 -0
- package/test/mockRoot/deploy/testInstance/testBU/query/testExisting_query_fixKeys.query-meta.json +11 -0
- package/test/mockRoot/deploy/testInstance/testBU/query/testExisting_query_fixKeys.query-meta.sql +6 -0
- package/test/mockRoot/deploy/testInstance/testBU/script/testExisting_script.script-meta.json +6 -0
- package/test/mockRoot/deploy/testInstance/testBU/script/testExisting_script.script-meta.ssjs +1 -0
- package/test/mockRoot/deploy/testInstance/testBU/script/testNew_script.script-meta.json +6 -0
- package/test/mockRoot/deploy/testInstance/testBU/script/testNew_script.script-meta.ssjs +1 -0
- package/test/mockRoot/deploy/testInstance/testBU/transactionalEmail/testExisting_temail.transactionalEmail-meta.json +3 -4
- package/test/mockRoot/deploy/testInstance/testBU/transactionalEmail/testNew_temail.transactionalEmail-meta.json +1 -6
- package/test/mockRoot/deploy/testInstance/testBU/triggeredSend/testExisting_triggeredSend.triggeredSend-meta.json +29 -0
- package/test/mockRoot/deploy/testInstance/testBU/triggeredSend/testNew_triggeredSend.triggeredSend-meta.json +29 -0
- package/test/mockRoot/deploy/testInstance/testBU/verification/testExisting_39f6a488-20eb-4ba0-b0b9.verification-meta.json +11 -0
- package/test/mockRoot/deploy/testInstance/testBU/verification/testNew_39f6a488-20eb-4ba0-b0b9.verification-meta.json +11 -0
- package/test/resourceFactory.js +77 -12
- package/test/resources/1111111/accountUser/retrieve-ActiveFlag=falseANDCustomerKey=testExisting_userANDEmaillike@-response.xml +27 -0
- package/test/resources/1111111/accountUser/retrieve-ActiveFlag=falseANDEmaillike@-response.xml +156 -0
- package/test/resources/1111111/accountUser/retrieve-ActiveFlag=trueANDEmailisNullORNamelikeapp userANDMustChangePassword=false-response.xml +87 -0
- package/test/resources/1111111/accountUser/retrieve-ActiveFlag=trueANDEmaillike@-response.xml +156 -0
- package/test/resources/1111111/accountUser/retrieve-CustomerKey=testExisting_userANDActiveFlag=trueANDEmailisNullORNamelikeapp userANDMustChangePassword=false-response.xml +27 -0
- package/test/resources/1111111/accountUserAccount/retrieve-AccountUser.AccountUserID=700301950-response.xml +60 -0
- package/test/resources/1111111/data/v1/customobjectdata/key/testExisting_dataExtensionShared/rowset/get-response.json +13 -0
- package/test/resources/1111111/dataExtension/create-expected.json +23 -0
- package/test/resources/1111111/dataExtension/create-response.xml +59 -0
- package/test/resources/1111111/dataExtension/retrieve-expected.json +55 -0
- package/test/resources/1111111/dataExtension/retrieve-expected.md +18 -0
- package/test/resources/1111111/dataExtension/retrieve-response.xml +27 -1
- package/test/resources/1111111/dataExtension/update-expected.json +55 -0
- package/test/resources/1111111/dataExtension/update-response.xml +57 -0
- package/test/resources/1111111/dataExtensionField/retrieve-CustomerKey=[testExisting_dataExtensionShared].[TriggerUpdate_randomNumber_]-response.xml +45 -0
- package/test/resources/1111111/dataExtensionField/retrieve-DataExtension.CustomerKey=testExisting_dataExtensionShared-response.xml +98 -0
- package/test/resources/1111111/dataExtensionField/retrieve-DataExtension.CustomerKey=testNew_dataExtensionSharedORDataExtension.CustomerKey=testExisting_dataExtensionShared-response.xml +98 -0
- package/test/resources/1111111/dataExtensionField/retrieve-response.xml +98 -0
- package/test/resources/1111111/dataExtensionTemplate/retrieve-response.xml +303 -0
- package/test/resources/1111111/dataFolder/retrieve-ContentType=synchronizeddataextensionORContentType=shared_salesforcedataextensionORContentType=shared_dataextensionORContentType=shared_dataORContentType=salesforcedataextensionORContentType=dataextensionORContentType=hidden-response.xml +387 -0
- package/test/resources/1111111/dataFolder/retrieve-response.xml +353 -9
- package/test/resources/1111111/user/retrieve-expected.md +4 -2
- package/test/resources/9999999/attributeGroup/retrieve-expected.json +25 -0
- package/test/resources/9999999/attributeSet/retrieve-expected.json +143 -0
- package/test/resources/9999999/automation/build-expected.json +5 -2
- package/test/resources/9999999/automation/create-expected.json +11 -8
- package/test/resources/9999999/automation/create-testNew_automation-expected.md +5 -4
- package/test/resources/9999999/automation/patch_fixKeys-pause-expected.json +44 -0
- package/test/resources/9999999/automation/patch_fixKeys-schedule-expected.json +44 -0
- package/test/resources/9999999/automation/perform-08afb0e2-b00a-4c88-ad2e-1f7f8788c560-response.xml +42 -0
- package/test/resources/9999999/automation/perform-08afb0e2-b00a-4c88-fixKey_pause-response.xml +42 -0
- package/test/resources/9999999/automation/perform-08afb0e2-b00a-4c88-fixKey_schedule-response.xml +42 -0
- package/test/resources/9999999/automation/perform-a8afb0e2-b00a-4c88-ad2e-1f7f8788c560-response.xml +42 -0
- package/test/resources/9999999/automation/retrieve-expected.json +5 -2
- package/test/resources/9999999/automation/retrieve-testExisting_automation-expected.md +3 -2
- package/test/resources/9999999/automation/schedule-08afb0e2-b00a-4c88-ad2e-1f7f8788c560-response.xml +52 -0
- package/test/resources/9999999/automation/schedule-08afb0e2-b00a-4c88-ad2e-pause-response.xml +38 -0
- package/test/resources/9999999/automation/schedule-08afb0e2-b00a-4c88-fixKey_pause-response.xml +52 -0
- package/test/resources/9999999/automation/schedule-08afb0e2-b00a-4c88-fixKey_schedule-response.xml +52 -0
- package/test/resources/9999999/automation/schedule-a8afb0e2-b00a-4c88-ad2e-1f7f8788c560-response.xml +52 -0
- package/test/resources/9999999/automation/template-expected.json +5 -2
- package/test/resources/9999999/automation/update-expected.json +1 -2
- package/test/resources/9999999/automation/update-testExisting_automation-expected.md +2 -2
- package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-1f7f8788c560/get-response.json +7 -0
- package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-pause/get-response.json +85 -0
- package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-pause/patch-response.json +85 -0
- package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-fixKey_pause/get-response.json +85 -0
- package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-fixKey_pause/patch-response.json +85 -0
- package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-fixKey_schedule/get-response.json +85 -0
- package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-fixKey_schedule/patch-response.json +85 -0
- package/test/resources/9999999/automation/v1/automations/a8afb0e2-b00a-4c88-ad2e-1f7f8788c560/get-response.json +1 -1
- package/test/resources/9999999/automation/v1/automations/post-response.json +27 -19
- package/test/resources/9999999/automation/v1/dataextracts/56c5370a-f988-4f36-b0ee-0f876573f6d7/patch-response.json +38 -0
- package/test/resources/9999999/automation/v1/dataextracts/post-response.json +38 -0
- package/test/resources/9999999/automation/v1/dataextracttypes/get-response.json +50 -0
- package/test/resources/9999999/automation/v1/dataverifications/post-response.json +12 -0
- package/test/resources/9999999/automation/v1/dataverifications/testExisting_39f6a488-20eb-4ba0-b0b9/delete-response.json +0 -0
- package/test/resources/9999999/automation/v1/dataverifications/testExisting_39f6a488-20eb-4ba0-b0b9/get-response.json +12 -0
- package/test/resources/9999999/automation/v1/dataverifications/testExisting_39f6a488-20eb-4ba0-b0b9/patch-response.json +12 -0
- package/test/resources/9999999/automation/v1/filetransfers/72c328ac-f5b0-4e37-91d3-a775666f15a6/patch-response.json +18 -0
- package/test/resources/9999999/automation/v1/filetransfers/post-response.json +18 -0
- package/test/resources/9999999/automation/v1/ftplocations/get-response.json +18 -0
- package/test/resources/9999999/automation/v1/imports/9d16f42c-2260-ed11-b849-48df37d1de8b/patch-response.json +31 -0
- package/test/resources/9999999/automation/v1/imports/get-response.json +1 -1
- package/test/resources/9999999/automation/v1/imports/post-response.json +30 -0
- package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dae/actions/start/post-response.txt +1 -0
- package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat_fixKeys/get-response.json +17 -0
- package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat_fixKeys/patch-response.json +18 -0
- package/test/resources/9999999/automation/v1/queries/get-response.json +18 -1
- package/test/resources/9999999/automation/v1/scripts/39f6a488-20eb-4ba0-b0b9-023725b574e4/patch-response.json +10 -0
- package/test/resources/9999999/automation/v1/scripts/get-response.json +12 -2
- package/test/resources/9999999/automation/v1/scripts/post-response.json +10 -0
- package/test/resources/9999999/dataExtension/build-expected.json +16 -0
- package/test/resources/9999999/dataExtension/delete-response.xml +42 -0
- package/test/resources/9999999/dataExtension/retrieve-Name=testExisting_dataExtension-response.xml +52 -0
- package/test/resources/9999999/dataExtension/retrieve-expected.json +16 -0
- package/test/resources/9999999/dataExtension/retrieve-expected.md +3 -1
- package/test/resources/9999999/dataExtension/template-expected.json +16 -0
- package/test/resources/9999999/dataExtension/update-expected.json +17 -1
- package/test/resources/9999999/dataExtensionField/retrieve-CustomerKey=[testExisting_dataExtension].[LastName]-response.xml +44 -0
- package/test/resources/9999999/dataExtensionField/retrieve-DataExtension.CustomerKey=testExisting_dataExtension-response.xml +133 -0
- package/test/resources/9999999/dataExtensionField/retrieve-DataExtension.CustomerKey=testNew_dataExtensionORDataExtension.CustomerKey=testExisting_dataExtension-response.xml +99 -0
- package/test/resources/9999999/dataExtensionField/retrieve-response.xml +36 -1
- package/test/resources/9999999/dataExtract/build-expected.json +35 -0
- package/test/resources/9999999/dataExtract/get-expected.json +39 -0
- package/test/resources/9999999/dataExtract/patch-expected.json +37 -0
- package/test/resources/9999999/dataExtract/post-expected.json +37 -0
- package/test/resources/9999999/dataExtract/template-expected.json +35 -0
- package/test/resources/9999999/dataFolder/retrieve-ContentType=contextual_suppression_listORContentType=publicationORContentType=suppression_listORContentType=mysubsORContentType=list-response.xml +136 -0
- package/test/resources/9999999/dataFolder/retrieve-ContentType=ssjsactivity-response.xml +48 -0
- package/test/resources/9999999/dataFolder/retrieve-ContentType=synchronizeddataextensionORContentType=shared_salesforcedataextensionORContentType=shared_dataextensionORContentType=shared_dataORContentType=salesforcedataextensionORContentType=dataextensionORContentType=hidden-response.xml +117 -0
- package/test/resources/9999999/dataFolder/retrieve-ContentType=triggered_send_journeybuilderORContentType=triggered_sendORContentType=hidden-response.xml +276 -0
- package/test/resources/9999999/dataFolder/retrieve-response.xml +23 -0
- package/test/resources/9999999/email/retrieve-response.xml +203 -0
- package/test/resources/9999999/fileTransfer/build-expected.json +15 -0
- package/test/resources/9999999/fileTransfer/get-expected.json +17 -0
- package/test/resources/9999999/fileTransfer/patch-expected.json +17 -0
- package/test/resources/9999999/fileTransfer/post-expected.json +17 -0
- package/test/resources/9999999/fileTransfer/template-expected.json +15 -0
- package/test/resources/9999999/hub/v1/contacts/schema/attributeGroups/get-response.json +628 -0
- package/test/resources/9999999/hub/v1/contacts/schema/setDefinitions/get-response.json +20194 -0
- package/test/resources/9999999/importFile/build-expected.json +27 -0
- package/test/resources/9999999/importFile/get-expected.json +29 -0
- package/test/resources/9999999/importFile/patch-expected.json +29 -0
- package/test/resources/9999999/importFile/post-expected.json +29 -0
- package/test/resources/9999999/importFile/template-expected.json +27 -0
- package/test/resources/9999999/interaction/v1/interactions/233d4413-922c-4568-85a5-e5cc77efc3be/delete-response.json +1 -0
- package/test/resources/9999999/legacy/v1/beta/bulk/automations/automation/definition/get-response.json +1 -1
- package/test/resources/9999999/messaging/v1/email/definitions/post-response.json +1 -1
- package/test/resources/9999999/messaging/v1/email/definitions/testExisting_temail/delete-response.json +6 -0
- package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation_fixKey_pause-response.xml +32 -0
- package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation_fixKey_schedule-response.xml +32 -0
- package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation_fixedKey_paused-response.xml +32 -0
- package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation_fixedKey_scheduled-response.xml +32 -0
- package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation_pause-response.xml +30 -0
- package/test/resources/9999999/program/retrieve-response.xml +21 -3
- package/test/resources/9999999/query/patch_fixKeys-expected.json +11 -0
- package/test/resources/9999999/query/patch_fixKeys-expected.sql +6 -0
- package/test/resources/9999999/queryDefinition/retrieve-CustomerKey=testExisting_query_fixKeysANDStatus=Active-response.xml +30 -0
- package/test/resources/9999999/queryDefinition/retrieve-CustomerKey=testExisting_query_fixedKeysANDStatus=Active-response.xml +30 -0
- package/test/resources/9999999/queryDefinition/retrieve-CustomerKey=testNew_queryANDStatus=Active-response.xml +30 -0
- package/test/resources/9999999/script/build-expected.json +6 -0
- package/test/resources/9999999/script/build-expected.ssjs +1 -0
- package/test/resources/9999999/script/get-expected.json +8 -0
- package/test/resources/9999999/script/get-expected.ssjs +1 -0
- package/test/resources/9999999/script/get_noScriptTag-expected.html +1 -0
- package/test/resources/9999999/script/get_noScriptTag-expected.json +8 -0
- package/test/resources/9999999/script/patch-expected.json +8 -0
- package/test/resources/9999999/script/patch-expected.ssjs +1 -0
- package/test/resources/9999999/script/post-expected.json +8 -0
- package/test/resources/9999999/script/post-expected.ssjs +1 -0
- package/test/resources/9999999/script/template-expected.json +6 -0
- package/test/resources/9999999/script/template-expected.ssjs +1 -0
- package/test/resources/9999999/transactionalEmail/build-expected.json +3 -7
- package/test/resources/9999999/transactionalEmail/get-expected.json +3 -7
- package/test/resources/9999999/transactionalEmail/patch-expected.json +3 -7
- package/test/resources/9999999/transactionalEmail/post-expected.json +3 -7
- package/test/resources/9999999/transactionalEmail/template-expected.json +3 -7
- package/test/resources/9999999/triggeredSend/build-expected.json +29 -0
- package/test/resources/9999999/triggeredSend/get-expected.json +29 -0
- package/test/resources/9999999/triggeredSend/patch-expected.json +29 -0
- package/test/resources/9999999/triggeredSend/post-expected.json +29 -0
- package/test/resources/9999999/triggeredSend/template-expected.json +29 -0
- package/test/resources/9999999/triggeredSendDefinition/create-response.xml +75 -0
- package/test/resources/9999999/triggeredSendDefinition/delete-response.xml +36 -0
- package/test/resources/9999999/triggeredSendDefinition/{retrieve-response.xml → retrieve-TriggeredSendStatusINNew,Active,Inactive,Moved,Canceled-response.xml} +4 -4
- package/test/resources/9999999/triggeredSendDefinition/update-response.xml +74 -0
- package/test/resources/9999999/verification/build-expected.json +11 -0
- package/test/resources/9999999/verification/get-expected.json +11 -0
- package/test/resources/9999999/verification/patch-expected.json +11 -0
- package/test/resources/9999999/verification/post-expected.json +11 -0
- package/test/resources/9999999/verification/template-expected.json +11 -0
- package/test/type.attributeGroup.test.js +55 -0
- package/test/type.attributeSet.test.js +55 -0
- package/test/type.automation.test.js +650 -17
- package/test/type.dataExtension.test.js +205 -46
- package/test/type.dataExtract.test.js +194 -0
- package/test/type.fileTransfer.test.js +192 -0
- package/test/type.importFile.test.js +193 -0
- package/test/type.journey.test.js +38 -11
- package/test/type.mobileKeyword.test.js +6 -5
- package/test/type.mobileMessage.test.js +6 -4
- package/test/type.query.test.js +470 -17
- package/test/type.script.test.js +372 -0
- package/test/type.transactionalEmail.test.js +12 -11
- package/test/type.transactionalPush.test.js +2 -4
- package/test/type.transactionalSMS.test.js +2 -4
- package/test/type.triggeredSend.test.js +154 -0
- package/test/type.user.test.js +22 -10
- package/test/type.verification.test.js +173 -0
- package/test/utils.js +11 -2
- package/types/mcdev.d.js +14 -0
- package/lib/metadataTypes/SetDefinition.js +0 -37
- /package/test/resources/1111111/accountUser/{retrieve-response.xml → retrieve-ActiveFlag=trueANDCustomerKey=testExisting_userANDEmaillike@-response.xml} +0 -0
- /package/test/resources/1111111/accountUserAccount/{retrieve-response.xml → retrieve-AccountUser.AccountUserIDIN700301950,700301951,7471228-response.xml} +0 -0
- /package/test/resources/1111111/businessUnit/{retrieve-response.xml → retrieve-ID=1111111-response.xml} +0 -0
- /package/test/resources/1111111/list/{retrieve-response.xml → retrieve-CustomerKey=All SubscribersORListName=All Subscribers-response.xml} +0 -0
- /package/test/resources/1111111/role/{retrieve-response.xml → retrieve-IsPrivate=false-response.xml} +0 -0
- /package/test/resources/9999999/emailSendDefinition/{retrieve-response.xml → retrieve-IsPlatformObject=falseANDDescriptionnotEqualsSFSendDefinition-response.xml} +0 -0
- /package/test/resources/9999999/queryDefinition/{retrieve-response.xml → retrieve-CustomerKey=testExisting_queryANDStatus=Active-response.xml} +0 -0
|
@@ -50,23 +50,73 @@ describe('type: dataExtension', () => {
|
|
|
50
50
|
);
|
|
51
51
|
return;
|
|
52
52
|
});
|
|
53
|
+
it('Should retrieve a shared dataExtension', async () => {
|
|
54
|
+
// WHEN
|
|
55
|
+
await handler.retrieve('testInstance/_ParentBU_', ['dataExtension']);
|
|
56
|
+
// THEN
|
|
57
|
+
assert.equal(process.exitCode, false, 'retrieve should not have thrown an error');
|
|
58
|
+
// get results from cache
|
|
59
|
+
const result = cache.getCache();
|
|
60
|
+
assert.equal(
|
|
61
|
+
result.dataExtension ? Object.keys(result.dataExtension).length : 0,
|
|
62
|
+
1,
|
|
63
|
+
'only one dataExtension expected'
|
|
64
|
+
);
|
|
65
|
+
assert.deepEqual(
|
|
66
|
+
await testUtils.getActualJson(
|
|
67
|
+
'testExisting_dataExtensionShared',
|
|
68
|
+
'dataExtension',
|
|
69
|
+
'_ParentBU_'
|
|
70
|
+
),
|
|
71
|
+
await testUtils.getExpectedJson('1111111', 'dataExtension', 'retrieve'),
|
|
72
|
+
|
|
73
|
+
'returned metadata was not equal expected'
|
|
74
|
+
);
|
|
75
|
+
// check if MD file was created and equals expectations
|
|
76
|
+
expect(
|
|
77
|
+
file(
|
|
78
|
+
testUtils.getActualDoc(
|
|
79
|
+
'testExisting_dataExtensionShared',
|
|
80
|
+
'dataExtension',
|
|
81
|
+
'_ParentBU_'
|
|
82
|
+
)
|
|
83
|
+
)
|
|
84
|
+
).to.equal(
|
|
85
|
+
file(testUtils.getExpectedFile('1111111', 'dataExtension', 'retrieve', 'md'))
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
assert.equal(
|
|
89
|
+
testUtils.getAPIHistoryLength(),
|
|
90
|
+
4,
|
|
91
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
92
|
+
);
|
|
93
|
+
return;
|
|
94
|
+
});
|
|
53
95
|
});
|
|
54
96
|
describe('Deploy ================', () => {
|
|
55
97
|
beforeEach(() => {
|
|
56
98
|
testUtils.mockSetup(true);
|
|
57
99
|
});
|
|
58
|
-
it('Should create & update a dataExtension', async () => {
|
|
100
|
+
it('Should create & update a dataExtension including a field rename', async () => {
|
|
59
101
|
// WHEN
|
|
60
|
-
await handler.deploy('testInstance/testBU', ['dataExtension']);
|
|
102
|
+
const deployResult = await handler.deploy('testInstance/testBU', ['dataExtension']);
|
|
61
103
|
// THEN
|
|
62
104
|
assert.equal(process.exitCode, false, 'deploy should not have thrown an error');
|
|
63
105
|
|
|
106
|
+
assert.equal(
|
|
107
|
+
deployResult['testInstance/testBU']?.dataExtension
|
|
108
|
+
? Object.keys(deployResult['testInstance/testBU']?.dataExtension).length
|
|
109
|
+
: 0,
|
|
110
|
+
2,
|
|
111
|
+
'two dataExtensions to be deployed'
|
|
112
|
+
);
|
|
113
|
+
|
|
64
114
|
// get results from cache
|
|
65
115
|
const result = cache.getCache();
|
|
66
116
|
assert.equal(
|
|
67
117
|
result.dataExtension ? Object.keys(result.dataExtension).length : 0,
|
|
68
|
-
|
|
69
|
-
'
|
|
118
|
+
3,
|
|
119
|
+
'three dataExtensions expected'
|
|
70
120
|
);
|
|
71
121
|
// insert
|
|
72
122
|
assert.deepEqual(
|
|
@@ -87,8 +137,104 @@ describe('type: dataExtension', () => {
|
|
|
87
137
|
);
|
|
88
138
|
return;
|
|
89
139
|
});
|
|
90
|
-
it('Should
|
|
91
|
-
|
|
140
|
+
it('Should create & update a shared dataExtension', async () => {
|
|
141
|
+
// WHEN
|
|
142
|
+
const deployResult = await handler.deploy('testInstance/_ParentBU_', ['dataExtension']);
|
|
143
|
+
// THEN
|
|
144
|
+
assert.equal(process.exitCode, false, 'deploy should not have thrown an error');
|
|
145
|
+
|
|
146
|
+
assert.equal(
|
|
147
|
+
deployResult['testInstance/_ParentBU_']?.dataExtension
|
|
148
|
+
? Object.keys(deployResult['testInstance/_ParentBU_']?.dataExtension).length
|
|
149
|
+
: 0,
|
|
150
|
+
2,
|
|
151
|
+
'two dataExtensions to be deployed'
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
// get results from cache
|
|
155
|
+
const result = cache.getCache();
|
|
156
|
+
assert.equal(
|
|
157
|
+
result.dataExtension ? Object.keys(result.dataExtension).length : 0,
|
|
158
|
+
2,
|
|
159
|
+
'two dataExtensions expected'
|
|
160
|
+
);
|
|
161
|
+
// insert
|
|
162
|
+
assert.deepEqual(
|
|
163
|
+
await testUtils.getActualJson(
|
|
164
|
+
'testNew_dataExtensionShared',
|
|
165
|
+
'dataExtension',
|
|
166
|
+
'_ParentBU_'
|
|
167
|
+
),
|
|
168
|
+
await testUtils.getExpectedJson('1111111', 'dataExtension', 'create'),
|
|
169
|
+
'returned metadata was not equal expected for create'
|
|
170
|
+
);
|
|
171
|
+
// update
|
|
172
|
+
assert.deepEqual(
|
|
173
|
+
await testUtils.getActualJson(
|
|
174
|
+
'testExisting_dataExtensionShared',
|
|
175
|
+
'dataExtension',
|
|
176
|
+
'_ParentBU_'
|
|
177
|
+
),
|
|
178
|
+
await testUtils.getExpectedJson('1111111', 'dataExtension', 'update'),
|
|
179
|
+
'returned metadata was not equal expected for update'
|
|
180
|
+
);
|
|
181
|
+
assert.equal(
|
|
182
|
+
testUtils.getAPIHistoryLength(),
|
|
183
|
+
8,
|
|
184
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
185
|
+
);
|
|
186
|
+
return;
|
|
187
|
+
});
|
|
188
|
+
it('Should create & update a shared dataExtension with --fixShared & --skipInteraction', async () => {
|
|
189
|
+
// WHEN
|
|
190
|
+
handler.setOptions({ fixShared: 'testBU', skipInteraction: true, _runningTest: true });
|
|
191
|
+
|
|
192
|
+
const deployResult = await handler.deploy('testInstance/_ParentBU_', ['dataExtension']);
|
|
193
|
+
// THEN
|
|
194
|
+
assert.equal(process.exitCode, false, 'deploy should not have thrown an error');
|
|
195
|
+
|
|
196
|
+
assert.equal(
|
|
197
|
+
deployResult['testInstance/_ParentBU_']?.dataExtension
|
|
198
|
+
? Object.keys(deployResult['testInstance/_ParentBU_']?.dataExtension).length
|
|
199
|
+
: 0,
|
|
200
|
+
2,
|
|
201
|
+
'two dataExtensions to be deployed'
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
// get results from cache
|
|
205
|
+
const result = cache.getCache();
|
|
206
|
+
assert.equal(
|
|
207
|
+
result.dataExtension ? Object.keys(result.dataExtension).length : 0,
|
|
208
|
+
2,
|
|
209
|
+
'two dataExtensions expected'
|
|
210
|
+
);
|
|
211
|
+
// insert
|
|
212
|
+
assert.deepEqual(
|
|
213
|
+
await testUtils.getActualJson(
|
|
214
|
+
'testNew_dataExtensionShared',
|
|
215
|
+
'dataExtension',
|
|
216
|
+
'_ParentBU_'
|
|
217
|
+
),
|
|
218
|
+
await testUtils.getExpectedJson('1111111', 'dataExtension', 'create'),
|
|
219
|
+
'returned metadata was not equal expected for create'
|
|
220
|
+
);
|
|
221
|
+
// update
|
|
222
|
+
assert.deepEqual(
|
|
223
|
+
await testUtils.getActualJson(
|
|
224
|
+
'testExisting_dataExtensionShared',
|
|
225
|
+
'dataExtension',
|
|
226
|
+
'_ParentBU_'
|
|
227
|
+
),
|
|
228
|
+
await testUtils.getExpectedJson('1111111', 'dataExtension', 'update'),
|
|
229
|
+
'returned metadata was not equal expected for update'
|
|
230
|
+
);
|
|
231
|
+
assert.equal(
|
|
232
|
+
testUtils.getAPIHistoryLength(),
|
|
233
|
+
12,
|
|
234
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
235
|
+
);
|
|
236
|
+
return;
|
|
237
|
+
});
|
|
92
238
|
});
|
|
93
239
|
describe('Templating ================', () => {
|
|
94
240
|
it('Should create a dataExtension template via retrieveAsTemplate and build it', async () => {
|
|
@@ -195,47 +341,60 @@ describe('type: dataExtension', () => {
|
|
|
195
341
|
});
|
|
196
342
|
});
|
|
197
343
|
describe('Delete ================', () => {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
344
|
+
it('Should delete the dataExtension', async () => {
|
|
345
|
+
// WHEN
|
|
346
|
+
const isDeleted = await handler.deleteByKey(
|
|
347
|
+
'testInstance/testBU',
|
|
348
|
+
'dataExtension',
|
|
349
|
+
'testExisting_dataExtension'
|
|
350
|
+
);
|
|
351
|
+
// THEN
|
|
352
|
+
assert.equal(process.exitCode, false, 'delete should not have thrown an error');
|
|
353
|
+
|
|
354
|
+
assert.equal(isDeleted, true, 'should have deleted the item');
|
|
355
|
+
return;
|
|
356
|
+
});
|
|
357
|
+
it('Should delete the dataExtensionField', async () => {
|
|
358
|
+
// WHEN
|
|
359
|
+
const isDeleted = await handler.deleteByKey(
|
|
360
|
+
'testInstance/testBU',
|
|
361
|
+
'dataExtensionField',
|
|
362
|
+
'testExisting_dataExtension.LastName'
|
|
363
|
+
);
|
|
364
|
+
// THEN
|
|
365
|
+
assert.equal(process.exitCode, false, 'delete should not have thrown an error');
|
|
366
|
+
|
|
367
|
+
assert.equal(isDeleted, true, 'should have deleted the item');
|
|
368
|
+
return;
|
|
369
|
+
});
|
|
210
370
|
});
|
|
211
371
|
describe('CI/CD ================', () => {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
// });
|
|
372
|
+
it('Should return a list of files based on their type and key', async () => {
|
|
373
|
+
// WHEN
|
|
374
|
+
const fileList = await handler.getFilesToCommit(
|
|
375
|
+
'testInstance/testBU',
|
|
376
|
+
'dataExtension',
|
|
377
|
+
['testExisting_dataExtension']
|
|
378
|
+
);
|
|
379
|
+
// THEN
|
|
380
|
+
assert.equal(
|
|
381
|
+
process.exitCode,
|
|
382
|
+
false,
|
|
383
|
+
'getFilesToCommit should not have thrown an error'
|
|
384
|
+
);
|
|
385
|
+
assert.equal(fileList.length, 2, 'expected only 2 file paths (json, md)');
|
|
386
|
+
|
|
387
|
+
assert.equal(
|
|
388
|
+
fileList[0].split('\\').join('/'),
|
|
389
|
+
'retrieve/testInstance/testBU/dataExtension/testExisting_dataExtension.dataExtension-meta.json',
|
|
390
|
+
'wrong JSON path'
|
|
391
|
+
);
|
|
392
|
+
assert.equal(
|
|
393
|
+
fileList[1].split('\\').join('/'),
|
|
394
|
+
'retrieve/testInstance/testBU/dataExtension/testExisting_dataExtension.dataExtension-doc.md',
|
|
395
|
+
'wrong MD path'
|
|
396
|
+
);
|
|
397
|
+
return;
|
|
398
|
+
});
|
|
240
399
|
});
|
|
241
400
|
});
|
|
@@ -0,0 +1,194 @@
|
|
|
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
|
+
const isDeleted = await handler.deleteByKey(
|
|
176
|
+
'testInstance/testBU',
|
|
177
|
+
'dataExtract',
|
|
178
|
+
'testExisting_fileTranfer'
|
|
179
|
+
);
|
|
180
|
+
// THEN
|
|
181
|
+
assert.equal(
|
|
182
|
+
process.exitCode,
|
|
183
|
+
1,
|
|
184
|
+
'deleteByKey should have thrown an error due to lack of support'
|
|
185
|
+
);
|
|
186
|
+
assert.equal(
|
|
187
|
+
isDeleted,
|
|
188
|
+
false,
|
|
189
|
+
'deleteByKey should have returned false due to lack of support'
|
|
190
|
+
);
|
|
191
|
+
return;
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
});
|
|
@@ -0,0 +1,192 @@
|
|
|
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
|
+
const isDeleted = await handler.deleteByKey(
|
|
174
|
+
'testInstance/testBU',
|
|
175
|
+
'fileTransfer',
|
|
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
|
+
assert.equal(
|
|
185
|
+
isDeleted,
|
|
186
|
+
false,
|
|
187
|
+
'deleteByKey should have returned false due to lack of support'
|
|
188
|
+
);
|
|
189
|
+
return;
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
});
|