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
package/test/type.query.test.js
CHANGED
|
@@ -27,8 +27,8 @@ describe('type: query', () => {
|
|
|
27
27
|
const result = cache.getCache();
|
|
28
28
|
assert.equal(
|
|
29
29
|
result.query ? Object.keys(result.query).length : 0,
|
|
30
|
-
|
|
31
|
-
'only
|
|
30
|
+
3,
|
|
31
|
+
'only three queries expected'
|
|
32
32
|
);
|
|
33
33
|
// normal test
|
|
34
34
|
assert.deepEqual(
|
|
@@ -53,7 +53,7 @@ describe('type: query', () => {
|
|
|
53
53
|
);
|
|
54
54
|
return;
|
|
55
55
|
});
|
|
56
|
-
it('Should retrieve one specific query', async () => {
|
|
56
|
+
it('Should retrieve one specific query by key', async () => {
|
|
57
57
|
// WHEN
|
|
58
58
|
await handler.retrieve('testInstance/testBU', ['query'], ['testExisting_query']);
|
|
59
59
|
// THEN
|
|
@@ -80,6 +80,61 @@ describe('type: query', () => {
|
|
|
80
80
|
);
|
|
81
81
|
return;
|
|
82
82
|
});
|
|
83
|
+
it('Should retrieve one specific query via --like', async () => {
|
|
84
|
+
// WHEN
|
|
85
|
+
handler.setOptions({ like: { key: '%Existing_query' } });
|
|
86
|
+
await handler.retrieve('testInstance/testBU', ['query']);
|
|
87
|
+
// THEN
|
|
88
|
+
assert.equal(process.exitCode, false, 'retrieve should not have thrown an error');
|
|
89
|
+
// get results from cache
|
|
90
|
+
const result = cache.getCache();
|
|
91
|
+
assert.equal(
|
|
92
|
+
result.query ? Object.keys(result.query).length : 0,
|
|
93
|
+
3,
|
|
94
|
+
'three queries in cache expected'
|
|
95
|
+
);
|
|
96
|
+
assert.deepEqual(
|
|
97
|
+
await testUtils.getActualJson('testExisting_query', 'query'),
|
|
98
|
+
await testUtils.getExpectedJson('9999999', 'query', 'get'),
|
|
99
|
+
'returned metadata was not equal expected'
|
|
100
|
+
);
|
|
101
|
+
expect(file(testUtils.getActualFile('testExisting_query', 'query', 'sql'))).to.equal(
|
|
102
|
+
file(testUtils.getExpectedFile('9999999', 'query', 'get', 'sql'))
|
|
103
|
+
);
|
|
104
|
+
expect(file(testUtils.getActualFile('testExisting_query2', 'query', 'sql'))).to.not
|
|
105
|
+
.exist;
|
|
106
|
+
assert.equal(
|
|
107
|
+
testUtils.getAPIHistoryLength(),
|
|
108
|
+
6,
|
|
109
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
110
|
+
);
|
|
111
|
+
return;
|
|
112
|
+
});
|
|
113
|
+
it('Should not retrieve any query via --like and key due to a mismatching filter', async () => {
|
|
114
|
+
// WHEN
|
|
115
|
+
handler.setOptions({ like: { key: 'NotExisting_query' } });
|
|
116
|
+
await handler.retrieve('testInstance/testBU', ['query']);
|
|
117
|
+
// THEN
|
|
118
|
+
assert.equal(process.exitCode, false, 'retrieve should not have thrown an error');
|
|
119
|
+
// get results from cache
|
|
120
|
+
const result = cache.getCache();
|
|
121
|
+
assert.equal(
|
|
122
|
+
result.query ? Object.keys(result.query).length : 0,
|
|
123
|
+
3,
|
|
124
|
+
'three queries in cache expected'
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
expect(file(testUtils.getActualFile('testExisting_query', 'query', 'sql'))).to.not
|
|
128
|
+
.exist;
|
|
129
|
+
expect(file(testUtils.getActualFile('testExisting_query2', 'query', 'sql'))).to.not
|
|
130
|
+
.exist;
|
|
131
|
+
assert.equal(
|
|
132
|
+
testUtils.getAPIHistoryLength(),
|
|
133
|
+
6,
|
|
134
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
135
|
+
);
|
|
136
|
+
return;
|
|
137
|
+
});
|
|
83
138
|
});
|
|
84
139
|
describe('Deploy ================', () => {
|
|
85
140
|
beforeEach(() => {
|
|
@@ -87,15 +142,26 @@ describe('type: query', () => {
|
|
|
87
142
|
});
|
|
88
143
|
it('Should create & upsert a query', async () => {
|
|
89
144
|
// WHEN
|
|
90
|
-
await handler.deploy(
|
|
145
|
+
const resultDeploy = await handler.deploy(
|
|
146
|
+
'testInstance/testBU',
|
|
147
|
+
['query'],
|
|
148
|
+
['testNew_query', 'testExisting_query']
|
|
149
|
+
);
|
|
91
150
|
// THEN
|
|
92
151
|
assert.equal(process.exitCode, false, 'deploy should not have thrown an error');
|
|
152
|
+
assert.equal(
|
|
153
|
+
resultDeploy['testInstance/testBU']?.query
|
|
154
|
+
? Object.keys(resultDeploy['testInstance/testBU']?.query).length
|
|
155
|
+
: 0,
|
|
156
|
+
2,
|
|
157
|
+
'two queries to be deployed'
|
|
158
|
+
);
|
|
93
159
|
// get results from cache
|
|
94
160
|
const result = cache.getCache();
|
|
95
161
|
assert.equal(
|
|
96
162
|
result.query ? Object.keys(result.query).length : 0,
|
|
97
|
-
|
|
98
|
-
'
|
|
163
|
+
4,
|
|
164
|
+
'four queries expected in cache'
|
|
99
165
|
);
|
|
100
166
|
// confirm created item
|
|
101
167
|
assert.deepEqual(
|
|
@@ -123,7 +189,356 @@ describe('type: query', () => {
|
|
|
123
189
|
);
|
|
124
190
|
return;
|
|
125
191
|
});
|
|
126
|
-
it('Should
|
|
192
|
+
it('Should deploy and execute with --execute', async () => {
|
|
193
|
+
handler.setOptions({ execute: true });
|
|
194
|
+
// WHEN
|
|
195
|
+
await handler.deploy(
|
|
196
|
+
'testInstance/testBU',
|
|
197
|
+
['query'],
|
|
198
|
+
['testExisting_query', 'testNew_query']
|
|
199
|
+
);
|
|
200
|
+
// THEN
|
|
201
|
+
assert.equal(
|
|
202
|
+
process.exitCode,
|
|
203
|
+
false,
|
|
204
|
+
'deploy with --execute should not have thrown an error'
|
|
205
|
+
);
|
|
206
|
+
// confirm updated item
|
|
207
|
+
assert.deepEqual(
|
|
208
|
+
await testUtils.getActualJson('testExisting_query', 'query'),
|
|
209
|
+
await testUtils.getExpectedJson('9999999', 'query', 'patch'),
|
|
210
|
+
'returned metadata was not equal expected for insert query'
|
|
211
|
+
);
|
|
212
|
+
expect(file(testUtils.getActualFile('testExisting_query', 'query', 'sql'))).to.equal(
|
|
213
|
+
file(testUtils.getExpectedFile('9999999', 'query', 'patch', 'sql'))
|
|
214
|
+
);
|
|
215
|
+
// check number of API calls
|
|
216
|
+
assert.equal(
|
|
217
|
+
testUtils.getAPIHistoryLength(),
|
|
218
|
+
12,
|
|
219
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
220
|
+
);
|
|
221
|
+
return;
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
describe('FixKeys ================', () => {
|
|
225
|
+
beforeEach(() => {
|
|
226
|
+
testUtils.mockSetup(true);
|
|
227
|
+
});
|
|
228
|
+
it('Should change the key during update with --changeKeyValue', async () => {
|
|
229
|
+
// WHEN
|
|
230
|
+
await handler.retrieve(
|
|
231
|
+
'testInstance/testBU',
|
|
232
|
+
['query'],
|
|
233
|
+
['testExisting_query_fixKeys']
|
|
234
|
+
);
|
|
235
|
+
handler.setOptions({
|
|
236
|
+
changeKeyValue: 'testExisting_query_fixedKeys',
|
|
237
|
+
fromRetrieve: true,
|
|
238
|
+
});
|
|
239
|
+
const deployed = await handler.deploy(
|
|
240
|
+
'testInstance/testBU',
|
|
241
|
+
['query'],
|
|
242
|
+
['testExisting_query_fixKeys']
|
|
243
|
+
);
|
|
244
|
+
// THEN
|
|
245
|
+
assert.equal(
|
|
246
|
+
process.exitCode,
|
|
247
|
+
false,
|
|
248
|
+
'deploy --changeKeyValue should not have thrown an error'
|
|
249
|
+
);
|
|
250
|
+
assert.equal(
|
|
251
|
+
Object.keys(deployed['testInstance/testBU'].query).length,
|
|
252
|
+
1,
|
|
253
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
254
|
+
);
|
|
255
|
+
assert.equal(
|
|
256
|
+
Object.keys(deployed['testInstance/testBU'].query)[0],
|
|
257
|
+
'testExisting_query_fixedKeys',
|
|
258
|
+
'returned keys do not correspond to expected fixed keys'
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
// confirm updated item
|
|
262
|
+
assert.deepEqual(
|
|
263
|
+
await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'),
|
|
264
|
+
await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'),
|
|
265
|
+
'returned metadata was not equal expected for update query'
|
|
266
|
+
);
|
|
267
|
+
expect(
|
|
268
|
+
file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql'))
|
|
269
|
+
).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql')));
|
|
270
|
+
// check number of API calls
|
|
271
|
+
assert.equal(
|
|
272
|
+
testUtils.getAPIHistoryLength(),
|
|
273
|
+
14,
|
|
274
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
275
|
+
);
|
|
276
|
+
return;
|
|
277
|
+
});
|
|
278
|
+
it('Should change the key during update with --changeKeyField', async () => {
|
|
279
|
+
// WHEN
|
|
280
|
+
await handler.retrieve(
|
|
281
|
+
'testInstance/testBU',
|
|
282
|
+
['query'],
|
|
283
|
+
['testExisting_query_fixKeys']
|
|
284
|
+
);
|
|
285
|
+
handler.setOptions({ changeKeyField: 'name', fromRetrieve: true });
|
|
286
|
+
const deployed = await handler.deploy(
|
|
287
|
+
'testInstance/testBU',
|
|
288
|
+
['query'],
|
|
289
|
+
['testExisting_query_fixKeys']
|
|
290
|
+
);
|
|
291
|
+
// THEN
|
|
292
|
+
assert.equal(
|
|
293
|
+
process.exitCode,
|
|
294
|
+
false,
|
|
295
|
+
'deploy --changeKeyValue should not have thrown an error'
|
|
296
|
+
);
|
|
297
|
+
assert.equal(
|
|
298
|
+
Object.keys(deployed['testInstance/testBU'].query).length,
|
|
299
|
+
1,
|
|
300
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
301
|
+
);
|
|
302
|
+
assert.equal(
|
|
303
|
+
Object.keys(deployed['testInstance/testBU'].query)[0],
|
|
304
|
+
'testExisting_query_fixedKeys',
|
|
305
|
+
'returned keys do not correspond to expected fixed keys'
|
|
306
|
+
);
|
|
307
|
+
// confirm updated item
|
|
308
|
+
assert.deepEqual(
|
|
309
|
+
await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'),
|
|
310
|
+
await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'),
|
|
311
|
+
'returned metadata was not equal expected for update query'
|
|
312
|
+
);
|
|
313
|
+
expect(
|
|
314
|
+
file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql'))
|
|
315
|
+
).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql')));
|
|
316
|
+
// check number of API calls
|
|
317
|
+
assert.equal(
|
|
318
|
+
testUtils.getAPIHistoryLength(),
|
|
319
|
+
14,
|
|
320
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
321
|
+
);
|
|
322
|
+
return;
|
|
323
|
+
});
|
|
324
|
+
it('Should run fixKeys but not find fixable keys and hence stop', async () => {
|
|
325
|
+
// WHEN
|
|
326
|
+
handler.setOptions({ skipInteraction: { fixKeysReretrieve: false } });
|
|
327
|
+
const resultFixKeys = await handler.fixKeys('testInstance/testBU', 'query', [
|
|
328
|
+
'testExisting_query',
|
|
329
|
+
]);
|
|
330
|
+
// THEN
|
|
331
|
+
assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error');
|
|
332
|
+
// check which keys were fixed
|
|
333
|
+
assert.equal(
|
|
334
|
+
resultFixKeys['testInstance/testBU'].length,
|
|
335
|
+
0,
|
|
336
|
+
'expected to find no keys to be fixed'
|
|
337
|
+
);
|
|
338
|
+
|
|
339
|
+
// get results from cache
|
|
340
|
+
const result = cache.getCache();
|
|
341
|
+
assert.equal(
|
|
342
|
+
result.query ? Object.keys(result.query).length : 0,
|
|
343
|
+
1,
|
|
344
|
+
'one query expected'
|
|
345
|
+
);
|
|
346
|
+
// check number of API calls
|
|
347
|
+
assert.equal(
|
|
348
|
+
testUtils.getAPIHistoryLength(),
|
|
349
|
+
7,
|
|
350
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
351
|
+
);
|
|
352
|
+
return;
|
|
353
|
+
});
|
|
354
|
+
it('Should fixKeys by key WITHOUT re-retrieving dependent types', async () => {
|
|
355
|
+
// WHEN
|
|
356
|
+
handler.setOptions({ skipInteraction: { fixKeysReretrieve: false } });
|
|
357
|
+
const resultFixKeys = await handler.fixKeys('testInstance/testBU', 'query', [
|
|
358
|
+
'testExisting_query_fixKeys',
|
|
359
|
+
'testExisting_query',
|
|
360
|
+
]);
|
|
361
|
+
assert.equal(
|
|
362
|
+
resultFixKeys['testInstance/testBU'].length,
|
|
363
|
+
1,
|
|
364
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
365
|
+
);
|
|
366
|
+
assert.equal(
|
|
367
|
+
resultFixKeys['testInstance/testBU'][0],
|
|
368
|
+
'testExisting_query_fixedKeys',
|
|
369
|
+
'returned keys do not correspond to expected fixed keys'
|
|
370
|
+
);
|
|
371
|
+
// THEN
|
|
372
|
+
assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error');
|
|
373
|
+
// confirm updated item
|
|
374
|
+
assert.deepEqual(
|
|
375
|
+
await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'),
|
|
376
|
+
await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'),
|
|
377
|
+
'returned metadata was not equal expected for update query'
|
|
378
|
+
);
|
|
379
|
+
expect(
|
|
380
|
+
file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql'))
|
|
381
|
+
).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql')));
|
|
382
|
+
// check number of API calls
|
|
383
|
+
assert.equal(
|
|
384
|
+
testUtils.getAPIHistoryLength(),
|
|
385
|
+
16,
|
|
386
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
387
|
+
);
|
|
388
|
+
return;
|
|
389
|
+
});
|
|
390
|
+
it('Should fixKeys by key WITHOUT re-retrieving dependent types and then --execute', async () => {
|
|
391
|
+
// WHEN
|
|
392
|
+
handler.setOptions({ skipInteraction: { fixKeysReretrieve: false }, execute: true });
|
|
393
|
+
const resultFixKeys = await handler.fixKeys('testInstance/testBU', 'query', [
|
|
394
|
+
'testExisting_query_fixKeys',
|
|
395
|
+
'testExisting_query',
|
|
396
|
+
]);
|
|
397
|
+
assert.equal(
|
|
398
|
+
resultFixKeys['testInstance/testBU'].length,
|
|
399
|
+
1,
|
|
400
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
401
|
+
);
|
|
402
|
+
assert.equal(
|
|
403
|
+
resultFixKeys['testInstance/testBU'][0],
|
|
404
|
+
'testExisting_query_fixedKeys',
|
|
405
|
+
'returned keys do not correspond to expected fixed keys'
|
|
406
|
+
);
|
|
407
|
+
// THEN
|
|
408
|
+
assert.equal(
|
|
409
|
+
process.exitCode,
|
|
410
|
+
false,
|
|
411
|
+
'fixKeys with --execute should not have thrown an error'
|
|
412
|
+
);
|
|
413
|
+
// confirm updated item
|
|
414
|
+
assert.deepEqual(
|
|
415
|
+
await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'),
|
|
416
|
+
await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'),
|
|
417
|
+
'returned metadata was not equal expected for update query'
|
|
418
|
+
);
|
|
419
|
+
expect(
|
|
420
|
+
file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql'))
|
|
421
|
+
).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql')));
|
|
422
|
+
// check number of API calls
|
|
423
|
+
assert.equal(
|
|
424
|
+
testUtils.getAPIHistoryLength(),
|
|
425
|
+
18,
|
|
426
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
427
|
+
);
|
|
428
|
+
return;
|
|
429
|
+
});
|
|
430
|
+
it('Should fixKeys by key AND re-retrieve dependent types', async () => {
|
|
431
|
+
// WHEN
|
|
432
|
+
handler.setOptions({ skipInteraction: { fixKeysReretrieve: true } });
|
|
433
|
+
const resultFixKeys = await handler.fixKeys('testInstance/testBU', 'query', [
|
|
434
|
+
'testExisting_query_fixKeys',
|
|
435
|
+
'testExisting_query',
|
|
436
|
+
]);
|
|
437
|
+
assert.equal(
|
|
438
|
+
resultFixKeys['testInstance/testBU'].length,
|
|
439
|
+
1,
|
|
440
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
441
|
+
);
|
|
442
|
+
assert.equal(
|
|
443
|
+
resultFixKeys['testInstance/testBU'][0],
|
|
444
|
+
'testExisting_query_fixedKeys',
|
|
445
|
+
'returned keys do not correspond to expected fixed keys'
|
|
446
|
+
);
|
|
447
|
+
// THEN
|
|
448
|
+
assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error');
|
|
449
|
+
// confirm updated item
|
|
450
|
+
assert.deepEqual(
|
|
451
|
+
await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'),
|
|
452
|
+
await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'),
|
|
453
|
+
'returned metadata was not equal expected for update query'
|
|
454
|
+
);
|
|
455
|
+
expect(
|
|
456
|
+
file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql'))
|
|
457
|
+
).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql')));
|
|
458
|
+
// check number of API calls
|
|
459
|
+
assert.equal(
|
|
460
|
+
testUtils.getAPIHistoryLength(),
|
|
461
|
+
34,
|
|
462
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
463
|
+
);
|
|
464
|
+
return;
|
|
465
|
+
});
|
|
466
|
+
it('Should fixKeys by key AND re-retrieve dependent types and then --execute', async () => {
|
|
467
|
+
// WHEN
|
|
468
|
+
handler.setOptions({ skipInteraction: { fixKeysReretrieve: true }, execute: true });
|
|
469
|
+
const resultFixKeys = await handler.fixKeys('testInstance/testBU', 'query', [
|
|
470
|
+
'testExisting_query_fixKeys',
|
|
471
|
+
'testExisting_query',
|
|
472
|
+
]);
|
|
473
|
+
assert.equal(
|
|
474
|
+
resultFixKeys['testInstance/testBU'].length,
|
|
475
|
+
1,
|
|
476
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
477
|
+
);
|
|
478
|
+
assert.equal(
|
|
479
|
+
resultFixKeys['testInstance/testBU'][0],
|
|
480
|
+
'testExisting_query_fixedKeys',
|
|
481
|
+
'returned keys do not correspond to expected fixed keys'
|
|
482
|
+
);
|
|
483
|
+
// THEN
|
|
484
|
+
assert.equal(
|
|
485
|
+
process.exitCode,
|
|
486
|
+
false,
|
|
487
|
+
'fixKeys with --execute should not have thrown an error'
|
|
488
|
+
);
|
|
489
|
+
// confirm updated item
|
|
490
|
+
assert.deepEqual(
|
|
491
|
+
await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'),
|
|
492
|
+
await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'),
|
|
493
|
+
'returned metadata was not equal expected for update query'
|
|
494
|
+
);
|
|
495
|
+
expect(
|
|
496
|
+
file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql'))
|
|
497
|
+
).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql')));
|
|
498
|
+
// check number of API calls
|
|
499
|
+
assert.equal(
|
|
500
|
+
testUtils.getAPIHistoryLength(),
|
|
501
|
+
36,
|
|
502
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
503
|
+
);
|
|
504
|
+
return;
|
|
505
|
+
});
|
|
506
|
+
it('Should fixKeys via --like WITHOUT re-retrieving dependent types', async () => {
|
|
507
|
+
// WHEN
|
|
508
|
+
handler.setOptions({
|
|
509
|
+
like: { key: 'testExisting_query_f%' },
|
|
510
|
+
skipInteraction: { fixKeysReretrieve: false },
|
|
511
|
+
});
|
|
512
|
+
const resultFixKeys = await handler.fixKeys('testInstance/testBU', 'query');
|
|
513
|
+
assert.equal(
|
|
514
|
+
resultFixKeys['testInstance/testBU'].length,
|
|
515
|
+
1,
|
|
516
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
517
|
+
);
|
|
518
|
+
assert.equal(
|
|
519
|
+
resultFixKeys['testInstance/testBU'][0],
|
|
520
|
+
'testExisting_query_fixedKeys',
|
|
521
|
+
'returned keys do not correspond to expected fixed keys'
|
|
522
|
+
);
|
|
523
|
+
// THEN
|
|
524
|
+
assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error');
|
|
525
|
+
// confirm updated item
|
|
526
|
+
assert.deepEqual(
|
|
527
|
+
await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'),
|
|
528
|
+
await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'),
|
|
529
|
+
'returned metadata was not equal expected for update query'
|
|
530
|
+
);
|
|
531
|
+
expect(
|
|
532
|
+
file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql'))
|
|
533
|
+
).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql')));
|
|
534
|
+
// check number of API calls
|
|
535
|
+
assert.equal(
|
|
536
|
+
testUtils.getAPIHistoryLength(),
|
|
537
|
+
13,
|
|
538
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
539
|
+
);
|
|
540
|
+
return;
|
|
541
|
+
});
|
|
127
542
|
});
|
|
128
543
|
describe('Templating ================', () => {
|
|
129
544
|
it('Should create a query template via retrieveAsTemplate and build it', async () => {
|
|
@@ -241,13 +656,15 @@ describe('type: query', () => {
|
|
|
241
656
|
describe('Delete ================', () => {
|
|
242
657
|
it('Should delete the item', async () => {
|
|
243
658
|
// WHEN
|
|
244
|
-
const
|
|
245
|
-
'
|
|
246
|
-
|
|
659
|
+
const isDeleted = await handler.deleteByKey(
|
|
660
|
+
'testInstance/testBU',
|
|
661
|
+
'query',
|
|
662
|
+
'testExisting_query'
|
|
663
|
+
);
|
|
247
664
|
// THEN
|
|
248
665
|
assert.equal(process.exitCode, false, 'delete should not have thrown an error');
|
|
249
666
|
|
|
250
|
-
assert.equal(
|
|
667
|
+
assert.equal(isDeleted, true, 'should have deleted the item');
|
|
251
668
|
return;
|
|
252
669
|
});
|
|
253
670
|
});
|
|
@@ -279,14 +696,50 @@ describe('type: query', () => {
|
|
|
279
696
|
});
|
|
280
697
|
});
|
|
281
698
|
describe('Execute ================', () => {
|
|
282
|
-
it('Should start
|
|
283
|
-
const
|
|
284
|
-
'
|
|
285
|
-
|
|
286
|
-
|
|
699
|
+
it('Should start a query by key', async () => {
|
|
700
|
+
const executedKeys = await handler.execute('testInstance/testBU', 'query', [
|
|
701
|
+
'testExisting_query',
|
|
702
|
+
]);
|
|
703
|
+
assert.equal(process.exitCode, false, 'execute should not have thrown an error');
|
|
704
|
+
assert.equal(
|
|
705
|
+
executedKeys['testInstance/testBU']?.length,
|
|
706
|
+
1,
|
|
707
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
287
708
|
);
|
|
709
|
+
assert.equal(
|
|
710
|
+
executedKeys['testInstance/testBU'][0],
|
|
711
|
+
'testExisting_query',
|
|
712
|
+
'returned keys do not correspond to expected fixed keys'
|
|
713
|
+
);
|
|
714
|
+
return;
|
|
715
|
+
});
|
|
716
|
+
it('Should start a query selected via --like', async () => {
|
|
717
|
+
handler.setOptions({ like: { key: 'testExist%query' } });
|
|
718
|
+
const executedKeys = await handler.execute('testInstance/testBU', 'query');
|
|
288
719
|
assert.equal(process.exitCode, false, 'execute should not have thrown an error');
|
|
289
|
-
assert.equal(
|
|
720
|
+
assert.equal(
|
|
721
|
+
executedKeys['testInstance/testBU']?.length,
|
|
722
|
+
1,
|
|
723
|
+
'returned number of keys does not correspond to number of expected fixed keys'
|
|
724
|
+
);
|
|
725
|
+
assert.equal(
|
|
726
|
+
executedKeys['testInstance/testBU'][0],
|
|
727
|
+
'testExisting_query',
|
|
728
|
+
'returned keys do not correspond to expected fixed keys'
|
|
729
|
+
);
|
|
730
|
+
return;
|
|
731
|
+
});
|
|
732
|
+
it('Should not start executing a query because key and --like was specified', async () => {
|
|
733
|
+
handler.setOptions({ like: { key: 'testExisting%' } });
|
|
734
|
+
const executedKeys = await handler.execute('testInstance/testBU', 'query', [
|
|
735
|
+
'testExisting_query',
|
|
736
|
+
]);
|
|
737
|
+
assert.equal(process.exitCode, true, 'execute should have thrown an error');
|
|
738
|
+
assert.equal(
|
|
739
|
+
Object.keys(executedKeys).length,
|
|
740
|
+
0,
|
|
741
|
+
'query was not supposed to be executed'
|
|
742
|
+
);
|
|
290
743
|
return;
|
|
291
744
|
});
|
|
292
745
|
});
|