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
|
@@ -27,8 +27,8 @@ describe('type: automation', () => {
|
|
|
27
27
|
const result = cache.getCache();
|
|
28
28
|
assert.equal(
|
|
29
29
|
result.automation ? Object.keys(result.automation).length : 0,
|
|
30
|
-
|
|
31
|
-
'only
|
|
30
|
+
4,
|
|
31
|
+
'only four automations expected'
|
|
32
32
|
);
|
|
33
33
|
assert.deepEqual(
|
|
34
34
|
await testUtils.getActualJson('testExisting_automation', 'automation'),
|
|
@@ -47,10 +47,9 @@ describe('type: automation', () => {
|
|
|
47
47
|
)
|
|
48
48
|
)
|
|
49
49
|
);
|
|
50
|
-
|
|
51
50
|
assert.equal(
|
|
52
51
|
testUtils.getAPIHistoryLength(),
|
|
53
|
-
|
|
52
|
+
18,
|
|
54
53
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
55
54
|
);
|
|
56
55
|
return;
|
|
@@ -62,16 +61,29 @@ describe('type: automation', () => {
|
|
|
62
61
|
});
|
|
63
62
|
it('Should create & update a automation', async () => {
|
|
64
63
|
// WHEN
|
|
65
|
-
await handler.deploy(
|
|
64
|
+
const deployResult = await handler.deploy(
|
|
65
|
+
'testInstance/testBU',
|
|
66
|
+
['automation', 'verification'],
|
|
67
|
+
['testExisting_automation', 'testNew_automation', 'testNew_39f6a488-20eb-4ba0-b0b9']
|
|
68
|
+
);
|
|
66
69
|
// THEN
|
|
67
70
|
assert.equal(process.exitCode, false, 'deploy should not have thrown an error');
|
|
68
71
|
|
|
69
|
-
//
|
|
70
|
-
const result = cache.getCache();
|
|
72
|
+
// check how many items were deployed
|
|
71
73
|
assert.equal(
|
|
72
|
-
|
|
74
|
+
deployResult['testInstance/testBU']?.automation
|
|
75
|
+
? Object.keys(deployResult['testInstance/testBU']?.automation).length
|
|
76
|
+
: 0,
|
|
73
77
|
2,
|
|
74
|
-
'two automations
|
|
78
|
+
'two automations to be deployed'
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// get results from cache
|
|
82
|
+
const cacheResult = cache.getCache();
|
|
83
|
+
assert.equal(
|
|
84
|
+
cacheResult.automation ? Object.keys(cacheResult.automation).length : 0,
|
|
85
|
+
5,
|
|
86
|
+
'three automations expected'
|
|
75
87
|
);
|
|
76
88
|
// insert
|
|
77
89
|
assert.deepEqual(
|
|
@@ -111,12 +123,438 @@ describe('type: automation', () => {
|
|
|
111
123
|
|
|
112
124
|
assert.equal(
|
|
113
125
|
testUtils.getAPIHistoryLength(),
|
|
114
|
-
|
|
126
|
+
25,
|
|
127
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
128
|
+
);
|
|
129
|
+
return;
|
|
130
|
+
});
|
|
131
|
+
it('Should update & schedule an automation with --schedule option', async () => {
|
|
132
|
+
// WHEN
|
|
133
|
+
handler.setOptions({ schedule: true });
|
|
134
|
+
const deployed = await handler.deploy(
|
|
135
|
+
'testInstance/testBU',
|
|
136
|
+
['automation', 'verification'],
|
|
137
|
+
['testExisting_automation', 'testNew_automation', 'testNew_39f6a488-20eb-4ba0-b0b9']
|
|
138
|
+
);
|
|
139
|
+
// THEN
|
|
140
|
+
assert.equal(
|
|
141
|
+
process.exitCode,
|
|
142
|
+
false,
|
|
143
|
+
'deploy with --execute should not have thrown an error'
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
// get results from cache
|
|
147
|
+
const cached = cache.getCache();
|
|
148
|
+
assert.equal(
|
|
149
|
+
cached.automation ? Object.keys(cached.automation).length : 0,
|
|
150
|
+
5,
|
|
151
|
+
'five cached automation expected'
|
|
152
|
+
);
|
|
153
|
+
assert.equal(
|
|
154
|
+
deployed['testInstance/testBU'].automation
|
|
155
|
+
? Object.keys(deployed['testInstance/testBU'].automation).length
|
|
156
|
+
: 0,
|
|
157
|
+
2,
|
|
158
|
+
'two deployed automation expected'
|
|
159
|
+
);
|
|
160
|
+
assert.equal(
|
|
161
|
+
deployed['testInstance/testBU'].automation
|
|
162
|
+
? Object.keys(deployed['testInstance/testBU'].automation)[0]
|
|
163
|
+
: null,
|
|
164
|
+
'testNew_automation',
|
|
165
|
+
'expected specific automation to have been deployed'
|
|
166
|
+
);
|
|
167
|
+
assert.equal(
|
|
168
|
+
deployed['testInstance/testBU'].automation
|
|
169
|
+
? Object.keys(deployed['testInstance/testBU'].automation)[1]
|
|
170
|
+
: null,
|
|
171
|
+
'testExisting_automation',
|
|
172
|
+
'expected specific automation to have been deployed'
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
// update
|
|
176
|
+
assert.deepEqual(
|
|
177
|
+
await testUtils.getActualJson('testExisting_automation', 'automation'),
|
|
178
|
+
await testUtils.getExpectedJson('9999999', 'automation', 'update'),
|
|
179
|
+
'returned metadata was not equal expected for update'
|
|
180
|
+
);
|
|
181
|
+
// check if MD file was created and equals expectations
|
|
182
|
+
expect(file(testUtils.getActualDoc('testExisting_automation', 'automation'))).to.equal(
|
|
183
|
+
file(
|
|
184
|
+
testUtils.getExpectedFile(
|
|
185
|
+
'9999999',
|
|
186
|
+
'automation',
|
|
187
|
+
'update-testExisting_automation',
|
|
188
|
+
'md'
|
|
189
|
+
)
|
|
190
|
+
)
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
assert.equal(
|
|
194
|
+
testUtils.getAPIHistoryLength(),
|
|
195
|
+
33,
|
|
196
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
197
|
+
);
|
|
198
|
+
return;
|
|
199
|
+
});
|
|
200
|
+
it('Should update & runOnce an automation with --execute option', async () => {
|
|
201
|
+
// WHEN
|
|
202
|
+
handler.setOptions({ execute: true });
|
|
203
|
+
const deployed = await handler.deploy(
|
|
204
|
+
'testInstance/testBU',
|
|
205
|
+
['automation', 'verification'],
|
|
206
|
+
['testExisting_automation', 'testNew_automation', 'testNew_39f6a488-20eb-4ba0-b0b9']
|
|
207
|
+
);
|
|
208
|
+
// THEN
|
|
209
|
+
assert.equal(
|
|
210
|
+
process.exitCode,
|
|
211
|
+
false,
|
|
212
|
+
'deploy with --execute should not have thrown an error'
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
// get results from cache
|
|
216
|
+
const cached = cache.getCache();
|
|
217
|
+
assert.equal(
|
|
218
|
+
cached.automation ? Object.keys(cached.automation).length : 0,
|
|
219
|
+
5,
|
|
220
|
+
'five cached automation expected'
|
|
221
|
+
);
|
|
222
|
+
assert.equal(
|
|
223
|
+
deployed['testInstance/testBU'].automation
|
|
224
|
+
? Object.keys(deployed['testInstance/testBU'].automation).length
|
|
225
|
+
: 0,
|
|
226
|
+
2,
|
|
227
|
+
'two deployed automation expected'
|
|
228
|
+
);
|
|
229
|
+
assert.equal(
|
|
230
|
+
deployed['testInstance/testBU'].automation
|
|
231
|
+
? Object.keys(deployed['testInstance/testBU'].automation)[0]
|
|
232
|
+
: null,
|
|
233
|
+
'testNew_automation',
|
|
234
|
+
'expected specific automation to have been deployed'
|
|
235
|
+
);
|
|
236
|
+
assert.equal(
|
|
237
|
+
deployed['testInstance/testBU'].automation
|
|
238
|
+
? Object.keys(deployed['testInstance/testBU'].automation)[1]
|
|
239
|
+
: null,
|
|
240
|
+
'testExisting_automation',
|
|
241
|
+
'expected specific automation to have been deployed'
|
|
242
|
+
);
|
|
243
|
+
// update
|
|
244
|
+
assert.deepEqual(
|
|
245
|
+
await testUtils.getActualJson('testExisting_automation', 'automation'),
|
|
246
|
+
await testUtils.getExpectedJson('9999999', 'automation', 'update'),
|
|
247
|
+
'returned metadata was not equal expected for update'
|
|
248
|
+
);
|
|
249
|
+
// check if MD file was created and equals expectations
|
|
250
|
+
expect(file(testUtils.getActualDoc('testExisting_automation', 'automation'))).to.equal(
|
|
251
|
+
file(
|
|
252
|
+
testUtils.getExpectedFile(
|
|
253
|
+
'9999999',
|
|
254
|
+
'automation',
|
|
255
|
+
'update-testExisting_automation',
|
|
256
|
+
'md'
|
|
257
|
+
)
|
|
258
|
+
)
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
assert.equal(
|
|
262
|
+
testUtils.getAPIHistoryLength(),
|
|
263
|
+
29,
|
|
264
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
265
|
+
);
|
|
266
|
+
return;
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
describe('FixKeys ================', () => {
|
|
270
|
+
beforeEach(() => {
|
|
271
|
+
testUtils.mockSetup(true);
|
|
272
|
+
});
|
|
273
|
+
it('Should run fixKeys but not find fixable keys and hence stop', async () => {
|
|
274
|
+
// WHEN
|
|
275
|
+
handler.setOptions({ skipInteraction: { fixKeysReretrieve: false } });
|
|
276
|
+
const resultFixKeys = await handler.fixKeys('testInstance/testBU', 'automation', [
|
|
277
|
+
'testExisting_automation',
|
|
278
|
+
]);
|
|
279
|
+
// THEN
|
|
280
|
+
assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error');
|
|
281
|
+
// check which keys were fixed
|
|
282
|
+
assert.equal(
|
|
283
|
+
resultFixKeys['testInstance/testBU'].length,
|
|
284
|
+
0,
|
|
285
|
+
'expected to find no keys to be fixed'
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
// get results from cache
|
|
289
|
+
const result = cache.getCache();
|
|
290
|
+
assert.equal(
|
|
291
|
+
result.automation ? Object.keys(result.automation).length : 0,
|
|
292
|
+
1,
|
|
293
|
+
'one automation expected'
|
|
294
|
+
);
|
|
295
|
+
testUtils.logAPIHistoryDebug();
|
|
296
|
+
// check number of API calls
|
|
297
|
+
assert.equal(
|
|
298
|
+
testUtils.getAPIHistoryLength(),
|
|
299
|
+
18,
|
|
300
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
301
|
+
);
|
|
302
|
+
return;
|
|
303
|
+
});
|
|
304
|
+
it('Should fixKeys by key w/o re-retrieving, auto-schedule', async () => {
|
|
305
|
+
// WHEN
|
|
306
|
+
handler.setOptions({ skipInteraction: { fixKeysReretrieve: false } });
|
|
307
|
+
const resultFixKeys = await handler.fixKeys('testInstance/testBU', 'automation', [
|
|
308
|
+
'testExisting_automation_fixKey_schedule',
|
|
309
|
+
'testExisting_automation',
|
|
310
|
+
]);
|
|
311
|
+
assert.equal(
|
|
312
|
+
resultFixKeys['testInstance/testBU'].length,
|
|
313
|
+
1,
|
|
314
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
315
|
+
);
|
|
316
|
+
assert.equal(
|
|
317
|
+
resultFixKeys['testInstance/testBU'][0],
|
|
318
|
+
'testExisting_automation_fixedKey_scheduled',
|
|
319
|
+
'returned keys do not correspond to expected fixed keys'
|
|
320
|
+
);
|
|
321
|
+
// THEN
|
|
322
|
+
assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error');
|
|
323
|
+
// confirm updated item
|
|
324
|
+
assert.deepEqual(
|
|
325
|
+
await testUtils.getActualJson(
|
|
326
|
+
'testExisting_automation_fixedKey_scheduled',
|
|
327
|
+
'automation'
|
|
328
|
+
),
|
|
329
|
+
await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-schedule'),
|
|
330
|
+
'returned metadata was not equal expected for update automation'
|
|
331
|
+
);
|
|
332
|
+
expect(
|
|
333
|
+
file(
|
|
334
|
+
testUtils.getActualDoc(
|
|
335
|
+
'testExisting_automation_fixedKey_scheduled',
|
|
336
|
+
'automation'
|
|
337
|
+
)
|
|
338
|
+
)
|
|
339
|
+
).to.exist;
|
|
340
|
+
// check number of API calls
|
|
341
|
+
assert.equal(
|
|
342
|
+
testUtils.getAPIHistoryLength(),
|
|
343
|
+
40,
|
|
344
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
345
|
+
);
|
|
346
|
+
return;
|
|
347
|
+
});
|
|
348
|
+
it('Should fixKeys by key w/o re-retrieving, auto-schedule and then --execute', async () => {
|
|
349
|
+
// WHEN
|
|
350
|
+
handler.setOptions({ skipInteraction: { fixKeysReretrieve: false }, execute: true });
|
|
351
|
+
const resultFixKeys = await handler.fixKeys('testInstance/testBU', 'automation', [
|
|
352
|
+
'testExisting_automation_fixKey_schedule',
|
|
353
|
+
'testExisting_automation',
|
|
354
|
+
]);
|
|
355
|
+
assert.equal(
|
|
356
|
+
resultFixKeys['testInstance/testBU'].length,
|
|
357
|
+
1,
|
|
358
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
359
|
+
);
|
|
360
|
+
assert.equal(
|
|
361
|
+
resultFixKeys['testInstance/testBU'][0],
|
|
362
|
+
'testExisting_automation_fixedKey_scheduled',
|
|
363
|
+
'returned keys do not correspond to expected fixed keys'
|
|
364
|
+
);
|
|
365
|
+
// THEN
|
|
366
|
+
assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error');
|
|
367
|
+
// confirm updated item
|
|
368
|
+
assert.deepEqual(
|
|
369
|
+
await testUtils.getActualJson(
|
|
370
|
+
'testExisting_automation_fixedKey_scheduled',
|
|
371
|
+
'automation'
|
|
372
|
+
),
|
|
373
|
+
await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-schedule'),
|
|
374
|
+
'returned metadata was not equal expected for update automation'
|
|
375
|
+
);
|
|
376
|
+
expect(
|
|
377
|
+
file(
|
|
378
|
+
testUtils.getActualDoc(
|
|
379
|
+
'testExisting_automation_fixedKey_scheduled',
|
|
380
|
+
'automation'
|
|
381
|
+
)
|
|
382
|
+
)
|
|
383
|
+
).to.exist;
|
|
384
|
+
// check number of API calls
|
|
385
|
+
assert.equal(
|
|
386
|
+
testUtils.getAPIHistoryLength(),
|
|
387
|
+
42,
|
|
388
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
389
|
+
);
|
|
390
|
+
return;
|
|
391
|
+
});
|
|
392
|
+
it('Should fixKeys by key w/o re-retrieving, auto-schedule and then --schedule', async () => {
|
|
393
|
+
// WHEN
|
|
394
|
+
handler.setOptions({ skipInteraction: { fixKeysReretrieve: false }, schedule: true });
|
|
395
|
+
const resultFixKeys = await handler.fixKeys('testInstance/testBU', 'automation', [
|
|
396
|
+
'testExisting_automation_fixKey_schedule',
|
|
397
|
+
'testExisting_automation',
|
|
398
|
+
]);
|
|
399
|
+
assert.equal(
|
|
400
|
+
resultFixKeys['testInstance/testBU'].length,
|
|
401
|
+
1,
|
|
402
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
403
|
+
);
|
|
404
|
+
assert.equal(
|
|
405
|
+
resultFixKeys['testInstance/testBU'][0],
|
|
406
|
+
'testExisting_automation_fixedKey_scheduled',
|
|
407
|
+
'returned keys do not correspond to expected fixed keys'
|
|
408
|
+
);
|
|
409
|
+
// THEN
|
|
410
|
+
assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error');
|
|
411
|
+
// confirm updated item
|
|
412
|
+
assert.deepEqual(
|
|
413
|
+
await testUtils.getActualJson(
|
|
414
|
+
'testExisting_automation_fixedKey_scheduled',
|
|
415
|
+
'automation'
|
|
416
|
+
),
|
|
417
|
+
await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-schedule'),
|
|
418
|
+
'returned metadata was not equal expected for update automation'
|
|
419
|
+
);
|
|
420
|
+
expect(
|
|
421
|
+
file(
|
|
422
|
+
testUtils.getActualDoc(
|
|
423
|
+
'testExisting_automation_fixedKey_scheduled',
|
|
424
|
+
'automation'
|
|
425
|
+
)
|
|
426
|
+
)
|
|
427
|
+
).to.exist;
|
|
428
|
+
// check number of API calls
|
|
429
|
+
assert.equal(
|
|
430
|
+
testUtils.getAPIHistoryLength(),
|
|
431
|
+
43,
|
|
432
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
433
|
+
);
|
|
434
|
+
return;
|
|
435
|
+
});
|
|
436
|
+
it('Should fixKeys by key w/o re-retrieving, deploy paused', async () => {
|
|
437
|
+
// WHEN
|
|
438
|
+
handler.setOptions({ skipInteraction: { fixKeysReretrieve: false } });
|
|
439
|
+
const resultFixKeys = await handler.fixKeys('testInstance/testBU', 'automation', [
|
|
440
|
+
'testExisting_automation_fixKey_pause',
|
|
441
|
+
]);
|
|
442
|
+
assert.equal(
|
|
443
|
+
resultFixKeys['testInstance/testBU'].length,
|
|
444
|
+
1,
|
|
445
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
446
|
+
);
|
|
447
|
+
assert.equal(
|
|
448
|
+
resultFixKeys['testInstance/testBU'][0],
|
|
449
|
+
'testExisting_automation_fixedKey_paused',
|
|
450
|
+
'returned keys do not correspond to expected fixed keys'
|
|
451
|
+
);
|
|
452
|
+
// THEN
|
|
453
|
+
assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error');
|
|
454
|
+
// confirm updated item
|
|
455
|
+
assert.deepEqual(
|
|
456
|
+
await testUtils.getActualJson(
|
|
457
|
+
'testExisting_automation_fixedKey_paused',
|
|
458
|
+
'automation'
|
|
459
|
+
),
|
|
460
|
+
await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-pause'),
|
|
461
|
+
'returned metadata was not equal expected for update automation'
|
|
462
|
+
);
|
|
463
|
+
expect(
|
|
464
|
+
file(
|
|
465
|
+
testUtils.getActualDoc('testExisting_automation_fixedKey_paused', 'automation')
|
|
466
|
+
)
|
|
467
|
+
).to.exist;
|
|
468
|
+
// check number of API calls
|
|
469
|
+
assert.equal(
|
|
470
|
+
testUtils.getAPIHistoryLength(),
|
|
471
|
+
35,
|
|
472
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
473
|
+
);
|
|
474
|
+
return;
|
|
475
|
+
});
|
|
476
|
+
it('Should fixKeys by key w/o re-retrieving, deploy paused and then --execute', async () => {
|
|
477
|
+
// WHEN
|
|
478
|
+
handler.setOptions({ skipInteraction: { fixKeysReretrieve: false }, execute: true });
|
|
479
|
+
const resultFixKeys = await handler.fixKeys('testInstance/testBU', 'automation', [
|
|
480
|
+
'testExisting_automation_fixKey_pause',
|
|
481
|
+
'testExisting_automation',
|
|
482
|
+
]);
|
|
483
|
+
assert.equal(
|
|
484
|
+
resultFixKeys['testInstance/testBU'].length,
|
|
485
|
+
1,
|
|
486
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
487
|
+
);
|
|
488
|
+
assert.equal(
|
|
489
|
+
resultFixKeys['testInstance/testBU'][0],
|
|
490
|
+
'testExisting_automation_fixedKey_paused',
|
|
491
|
+
'returned keys do not correspond to expected fixed keys'
|
|
492
|
+
);
|
|
493
|
+
// THEN
|
|
494
|
+
assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error');
|
|
495
|
+
// confirm updated item
|
|
496
|
+
assert.deepEqual(
|
|
497
|
+
await testUtils.getActualJson(
|
|
498
|
+
'testExisting_automation_fixedKey_paused',
|
|
499
|
+
'automation'
|
|
500
|
+
),
|
|
501
|
+
await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-pause'),
|
|
502
|
+
'returned metadata was not equal expected for update automation'
|
|
503
|
+
);
|
|
504
|
+
expect(
|
|
505
|
+
file(
|
|
506
|
+
testUtils.getActualDoc('testExisting_automation_fixedKey_paused', 'automation')
|
|
507
|
+
)
|
|
508
|
+
).to.exist;
|
|
509
|
+
// check number of API calls
|
|
510
|
+
assert.equal(
|
|
511
|
+
testUtils.getAPIHistoryLength(),
|
|
512
|
+
41,
|
|
513
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
514
|
+
);
|
|
515
|
+
return;
|
|
516
|
+
});
|
|
517
|
+
it('Should fixKeys by key w/o re-retrieving, deploy paused and then --schedule', async () => {
|
|
518
|
+
// WHEN
|
|
519
|
+
handler.setOptions({ skipInteraction: { fixKeysReretrieve: false }, schedule: true });
|
|
520
|
+
const resultFixKeys = await handler.fixKeys('testInstance/testBU', 'automation', [
|
|
521
|
+
'testExisting_automation_fixKey_pause',
|
|
522
|
+
'testExisting_automation',
|
|
523
|
+
]);
|
|
524
|
+
assert.equal(
|
|
525
|
+
resultFixKeys['testInstance/testBU'].length,
|
|
526
|
+
1,
|
|
527
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
528
|
+
);
|
|
529
|
+
assert.equal(
|
|
530
|
+
resultFixKeys['testInstance/testBU'][0],
|
|
531
|
+
'testExisting_automation_fixedKey_paused',
|
|
532
|
+
'returned keys do not correspond to expected fixed keys'
|
|
533
|
+
);
|
|
534
|
+
// THEN
|
|
535
|
+
assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error');
|
|
536
|
+
// confirm updated item
|
|
537
|
+
assert.deepEqual(
|
|
538
|
+
await testUtils.getActualJson(
|
|
539
|
+
'testExisting_automation_fixedKey_paused',
|
|
540
|
+
'automation'
|
|
541
|
+
),
|
|
542
|
+
await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-pause'),
|
|
543
|
+
'returned metadata was not equal expected for update automation'
|
|
544
|
+
);
|
|
545
|
+
expect(
|
|
546
|
+
file(
|
|
547
|
+
testUtils.getActualDoc('testExisting_automation_fixedKey_paused', 'automation')
|
|
548
|
+
)
|
|
549
|
+
).to.exist;
|
|
550
|
+
// check number of API calls
|
|
551
|
+
assert.equal(
|
|
552
|
+
testUtils.getAPIHistoryLength(),
|
|
553
|
+
43,
|
|
115
554
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
116
555
|
);
|
|
117
556
|
return;
|
|
118
557
|
});
|
|
119
|
-
it('Should change the key during update via --changeKeyValue');
|
|
120
558
|
});
|
|
121
559
|
describe('Templating ================', () => {
|
|
122
560
|
it('Should create a automation template via retrieveAsTemplate and build it', async () => {
|
|
@@ -163,7 +601,7 @@ describe('type: automation', () => {
|
|
|
163
601
|
);
|
|
164
602
|
assert.equal(
|
|
165
603
|
testUtils.getAPIHistoryLength(),
|
|
166
|
-
|
|
604
|
+
20,
|
|
167
605
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
168
606
|
);
|
|
169
607
|
return;
|
|
@@ -210,7 +648,7 @@ describe('type: automation', () => {
|
|
|
210
648
|
);
|
|
211
649
|
assert.equal(
|
|
212
650
|
testUtils.getAPIHistoryLength(),
|
|
213
|
-
|
|
651
|
+
18,
|
|
214
652
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
215
653
|
);
|
|
216
654
|
return;
|
|
@@ -219,13 +657,15 @@ describe('type: automation', () => {
|
|
|
219
657
|
describe('Delete ================', () => {
|
|
220
658
|
it('Should delete the item', async () => {
|
|
221
659
|
// WHEN
|
|
222
|
-
const
|
|
223
|
-
'
|
|
224
|
-
|
|
660
|
+
const isDeleted = await handler.deleteByKey(
|
|
661
|
+
'testInstance/testBU',
|
|
662
|
+
'automation',
|
|
663
|
+
'testExisting_automation'
|
|
664
|
+
);
|
|
225
665
|
// THEN
|
|
226
666
|
assert.equal(process.exitCode, false, 'delete should not have thrown an error');
|
|
227
667
|
|
|
228
|
-
assert.equal(
|
|
668
|
+
assert.equal(isDeleted, true, 'should have deleted the item');
|
|
229
669
|
return;
|
|
230
670
|
});
|
|
231
671
|
});
|
|
@@ -256,4 +696,197 @@ describe('type: automation', () => {
|
|
|
256
696
|
return;
|
|
257
697
|
});
|
|
258
698
|
});
|
|
699
|
+
describe('Schedule ================', () => {
|
|
700
|
+
it('Should schedule an automation by key', async () => {
|
|
701
|
+
const executedKeys = await handler.schedule('testInstance/testBU', 'automation', [
|
|
702
|
+
'testExisting_automation',
|
|
703
|
+
]);
|
|
704
|
+
assert.equal(process.exitCode, false, 'execute should not have thrown an error');
|
|
705
|
+
assert.equal(
|
|
706
|
+
executedKeys['testInstance/testBU']?.length,
|
|
707
|
+
1,
|
|
708
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
709
|
+
);
|
|
710
|
+
assert.equal(
|
|
711
|
+
executedKeys['testInstance/testBU'][0],
|
|
712
|
+
'testExisting_automation',
|
|
713
|
+
'returned keys do not correspond to expected fixed keys'
|
|
714
|
+
);
|
|
715
|
+
return;
|
|
716
|
+
});
|
|
717
|
+
it('Should schedule an automation selected via --like', async () => {
|
|
718
|
+
handler.setOptions({ like: { key: 'testExist%automation' } });
|
|
719
|
+
const executedKeys = await handler.schedule('testInstance/testBU', 'automation');
|
|
720
|
+
assert.equal(process.exitCode, false, 'execute should not have thrown an error');
|
|
721
|
+
assert.equal(
|
|
722
|
+
executedKeys['testInstance/testBU']?.length,
|
|
723
|
+
1,
|
|
724
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
725
|
+
);
|
|
726
|
+
assert.equal(
|
|
727
|
+
executedKeys['testInstance/testBU'][0],
|
|
728
|
+
'testExisting_automation',
|
|
729
|
+
'returned keys do not correspond to expected fixed keys'
|
|
730
|
+
);
|
|
731
|
+
return;
|
|
732
|
+
});
|
|
733
|
+
it('Should not schedule executing an automation because key and --like was specified', async () => {
|
|
734
|
+
handler.setOptions({ like: { key: 'testExisting%' } });
|
|
735
|
+
const executedKeys = await handler.schedule('testInstance/testBU', 'automation', [
|
|
736
|
+
'testExisting_automation',
|
|
737
|
+
]);
|
|
738
|
+
assert.equal(process.exitCode, true, 'execute should have thrown an error');
|
|
739
|
+
assert.equal(
|
|
740
|
+
Object.keys(executedKeys).length,
|
|
741
|
+
0,
|
|
742
|
+
'automation was not supposed to be executed'
|
|
743
|
+
);
|
|
744
|
+
return;
|
|
745
|
+
});
|
|
746
|
+
});
|
|
747
|
+
describe('Execute ================', () => {
|
|
748
|
+
it('Should execute --schedule an automation by key', async () => {
|
|
749
|
+
handler.setOptions({ schedule: true });
|
|
750
|
+
const executedKeys = await handler.execute('testInstance/testBU', 'automation', [
|
|
751
|
+
'testExisting_automation',
|
|
752
|
+
]);
|
|
753
|
+
assert.equal(process.exitCode, false, 'execute should not have thrown an error');
|
|
754
|
+
assert.equal(
|
|
755
|
+
executedKeys['testInstance/testBU']?.length,
|
|
756
|
+
1,
|
|
757
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
758
|
+
);
|
|
759
|
+
assert.equal(
|
|
760
|
+
executedKeys['testInstance/testBU'][0],
|
|
761
|
+
'testExisting_automation',
|
|
762
|
+
'returned keys do not correspond to expected fixed keys'
|
|
763
|
+
);
|
|
764
|
+
return;
|
|
765
|
+
});
|
|
766
|
+
it('Should execute --schedule an automation selected via --like', async () => {
|
|
767
|
+
handler.setOptions({ like: { key: 'testExist%automation' }, schedule: true });
|
|
768
|
+
const executedKeys = await handler.execute('testInstance/testBU', 'automation');
|
|
769
|
+
assert.equal(process.exitCode, false, 'execute should not have thrown an error');
|
|
770
|
+
assert.equal(
|
|
771
|
+
executedKeys['testInstance/testBU']?.length,
|
|
772
|
+
1,
|
|
773
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
774
|
+
);
|
|
775
|
+
assert.equal(
|
|
776
|
+
executedKeys['testInstance/testBU'][0],
|
|
777
|
+
'testExisting_automation',
|
|
778
|
+
'returned keys do not correspond to expected fixed keys'
|
|
779
|
+
);
|
|
780
|
+
return;
|
|
781
|
+
});
|
|
782
|
+
it('Should not execute --schedule executing an automation because key and --like was specified', async () => {
|
|
783
|
+
handler.setOptions({ like: { key: 'testExisting%' }, schedule: true });
|
|
784
|
+
const executedKeys = await handler.execute('testInstance/testBU', 'automation', [
|
|
785
|
+
'testExisting_automation',
|
|
786
|
+
]);
|
|
787
|
+
assert.equal(process.exitCode, true, 'execute should have thrown an error');
|
|
788
|
+
assert.equal(
|
|
789
|
+
Object.keys(executedKeys).length,
|
|
790
|
+
0,
|
|
791
|
+
'automation was not supposed to be executed'
|
|
792
|
+
);
|
|
793
|
+
return;
|
|
794
|
+
});
|
|
795
|
+
it('Should runOnce an automation by key', async () => {
|
|
796
|
+
const executedKeys = await handler.execute('testInstance/testBU', 'automation', [
|
|
797
|
+
'testExisting_automation',
|
|
798
|
+
]);
|
|
799
|
+
assert.equal(process.exitCode, false, 'execute should not have thrown an error');
|
|
800
|
+
assert.equal(
|
|
801
|
+
executedKeys['testInstance/testBU']?.length,
|
|
802
|
+
1,
|
|
803
|
+
'automation was supposed to be executed'
|
|
804
|
+
);
|
|
805
|
+
assert.equal(
|
|
806
|
+
executedKeys['testInstance/testBU'][0],
|
|
807
|
+
'testExisting_automation',
|
|
808
|
+
'returned keys do not correspond to expected fixed keys'
|
|
809
|
+
);
|
|
810
|
+
return;
|
|
811
|
+
});
|
|
812
|
+
it('Should runOnce an automation selected via --like', async () => {
|
|
813
|
+
handler.setOptions({ like: { key: 'testExist%automation' } });
|
|
814
|
+
const executedKeys = await handler.execute('testInstance/testBU', 'automation');
|
|
815
|
+
assert.equal(process.exitCode, false, 'execute should not have thrown an error');
|
|
816
|
+
assert.equal(
|
|
817
|
+
executedKeys['testInstance/testBU']?.length,
|
|
818
|
+
1,
|
|
819
|
+
'automation was supposed to be executed'
|
|
820
|
+
);
|
|
821
|
+
assert.equal(
|
|
822
|
+
executedKeys['testInstance/testBU'][0],
|
|
823
|
+
'testExisting_automation',
|
|
824
|
+
'returned keys do not correspond to expected fixed keys'
|
|
825
|
+
);
|
|
826
|
+
|
|
827
|
+
return;
|
|
828
|
+
});
|
|
829
|
+
it('Should not runOnce executing an automation because key and --like was specified', async () => {
|
|
830
|
+
handler.setOptions({ like: { key: 'testExisting%' } });
|
|
831
|
+
const executedKeys = await handler.execute('testInstance/testBU', 'automation', [
|
|
832
|
+
'testExisting_automation',
|
|
833
|
+
]);
|
|
834
|
+
assert.equal(process.exitCode, true, 'execute should have thrown an error');
|
|
835
|
+
assert.equal(
|
|
836
|
+
Object.keys(executedKeys).length,
|
|
837
|
+
0,
|
|
838
|
+
'automation was not supposed to be executed'
|
|
839
|
+
);
|
|
840
|
+
|
|
841
|
+
return;
|
|
842
|
+
});
|
|
843
|
+
});
|
|
844
|
+
describe('Pause ================', () => {
|
|
845
|
+
it('Should pause a automation by key', async () => {
|
|
846
|
+
const pausedKeys = await handler.pause('testInstance/testBU', 'automation', [
|
|
847
|
+
'testExisting_automation_pause',
|
|
848
|
+
]);
|
|
849
|
+
assert.equal(process.exitCode, false, 'pause should not have thrown an error');
|
|
850
|
+
assert.equal(
|
|
851
|
+
pausedKeys['testInstance/testBU']?.length,
|
|
852
|
+
1,
|
|
853
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
854
|
+
);
|
|
855
|
+
assert.equal(
|
|
856
|
+
pausedKeys['testInstance/testBU'][0],
|
|
857
|
+
'testExisting_automation_pause',
|
|
858
|
+
'returned keys do not correspond to expected fixed keys'
|
|
859
|
+
);
|
|
860
|
+
return;
|
|
861
|
+
});
|
|
862
|
+
it('Should pause a automation selected via --like', async () => {
|
|
863
|
+
handler.setOptions({ like: { key: 'testExisting_a%n_pause' } });
|
|
864
|
+
const pausedKeys = await handler.pause('testInstance/testBU', 'automation');
|
|
865
|
+
assert.equal(process.exitCode, false, 'pause should not have thrown an error');
|
|
866
|
+
assert.equal(
|
|
867
|
+
pausedKeys['testInstance/testBU']?.length,
|
|
868
|
+
1,
|
|
869
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
870
|
+
);
|
|
871
|
+
assert.equal(
|
|
872
|
+
pausedKeys['testInstance/testBU'][0],
|
|
873
|
+
'testExisting_automation_pause',
|
|
874
|
+
'returned keys do not correspond to expected fixed keys'
|
|
875
|
+
);
|
|
876
|
+
return;
|
|
877
|
+
});
|
|
878
|
+
it('Should not pause automation because key and --like was specified', async () => {
|
|
879
|
+
handler.setOptions({ like: { key: 'testExisting_a%n_pause' } });
|
|
880
|
+
const pausedKeys = await handler.pause('testInstance/testBU', 'automation', [
|
|
881
|
+
'testExisting_automation_pause',
|
|
882
|
+
]);
|
|
883
|
+
assert.equal(process.exitCode, true, 'pause should have thrown an error');
|
|
884
|
+
assert.equal(
|
|
885
|
+
Object.keys(pausedKeys).length,
|
|
886
|
+
0,
|
|
887
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
888
|
+
);
|
|
889
|
+
return;
|
|
890
|
+
});
|
|
891
|
+
});
|
|
259
892
|
});
|