From 3c82b21830dd6b77660097fc777260ea9b549b76 Mon Sep 17 00:00:00 2001 From: Yuliia Likhytska Date: Fri, 8 Sep 2023 22:05:39 +0200 Subject: [PATCH] #1084: additional tests for verification --- .../9999999/automation/build-expected.json | 12 ++ .../9999999/automation/retrieve-expected.json | 12 ++ ...trieve-testExisting_automation-expected.md | 3 + .../9999999/automation/template-expected.json | 12 ++ .../get-response.json | 21 +++ .../get-response.json | 12 ++ .../patch-response.json | 12 ++ .../get-response.json | 12 ++ .../patch-response.json | 12 ++ .../get-response.json | 12 ++ .../patch-response.json | 12 ++ .../NOTupdateNotificationsEmail-expected.json | 11 ++ .../9999999/verification/clear-expected.json} | 4 +- test/type.automation.test.js | 56 +++---- test/type.query.test.js | 4 +- test/type.verification.test.js | 138 +++++++++++++++--- 16 files changed, 296 insertions(+), 49 deletions(-) create mode 100644 test/resources/9999999/automation/v1/dataverifications/testExisting_verification_NOTupdateNotificationsEmail/get-response.json create mode 100644 test/resources/9999999/automation/v1/dataverifications/testExisting_verification_NOTupdateNotificationsEmail/patch-response.json create mode 100644 test/resources/9999999/automation/v1/dataverifications/testExisting_verification_NOTupdateNotificationsNote/get-response.json create mode 100644 test/resources/9999999/automation/v1/dataverifications/testExisting_verification_NOTupdateNotificationsNote/patch-response.json create mode 100644 test/resources/9999999/automation/v1/dataverifications/testExisting_verification_clear/get-response.json create mode 100644 test/resources/9999999/automation/v1/dataverifications/testExisting_verification_clear/patch-response.json create mode 100644 test/resources/9999999/verification/NOTupdateNotificationsEmail-expected.json rename test/{mockRoot/deploy/testInstance/testBU/verification/testExisting_verification_updateNotificationsEmail.verification-meta.json => resources/9999999/verification/clear-expected.json} (75%) diff --git a/test/resources/9999999/automation/build-expected.json b/test/resources/9999999/automation/build-expected.json index d46d8e646..ce762f784 100644 --- a/test/resources/9999999/automation/build-expected.json +++ b/test/resources/9999999/automation/build-expected.json @@ -48,6 +48,18 @@ { "name": "testTemplated_verification_updateNotificationsEmail", "r__type": "verification" + }, + { + "name": "testTemplated_verification_NOTupdateNotificationsEmail", + "r__type": "verification" + }, + { + "name": "testTemplated_verification_NOTupdateNotificationsNote", + "r__type": "verification" + }, + { + "name": "testTemplated_verification_clear", + "r__type": "verification" } ], "name": "" diff --git a/test/resources/9999999/automation/retrieve-expected.json b/test/resources/9999999/automation/retrieve-expected.json index 361f9661a..6f66533b3 100644 --- a/test/resources/9999999/automation/retrieve-expected.json +++ b/test/resources/9999999/automation/retrieve-expected.json @@ -48,6 +48,18 @@ { "name": "testExisting_verification_updateNotificationsEmail", "r__type": "verification" + }, + { + "name": "testExisting_verification_NOTupdateNotificationsEmail", + "r__type": "verification" + }, + { + "name": "testExisting_verification_NOTupdateNotificationsNote", + "r__type": "verification" + }, + { + "name": "testExisting_verification_clear", + "r__type": "verification" } ], "name": "" diff --git a/test/resources/9999999/automation/retrieve-testExisting_automation-expected.md b/test/resources/9999999/automation/retrieve-testExisting_automation-expected.md index d34228f92..67a8afb07 100644 --- a/test/resources/9999999/automation/retrieve-testExisting_automation-expected.md +++ b/test/resources/9999999/automation/retrieve-testExisting_automation-expected.md @@ -31,3 +31,6 @@ | _1.7: verification_
testExisting_39f6a488-20eb-4ba0-b0b9 | | _1.8: verification_
testExisting_verification_updateNotificationsNote | | _1.9: verification_
testExisting_verification_updateNotificationsEmail | +| _1.10: verification_
testExisting_verification_NOTupdateNotificationsEmail | +| _1.11: verification_
testExisting_verification_NOTupdateNotificationsNote | +| _1.12: verification_
testExisting_verification_clear | diff --git a/test/resources/9999999/automation/template-expected.json b/test/resources/9999999/automation/template-expected.json index 6cbcaf6cf..5928fb1d8 100644 --- a/test/resources/9999999/automation/template-expected.json +++ b/test/resources/9999999/automation/template-expected.json @@ -48,6 +48,18 @@ { "name": "{{{prefix}}}verification_updateNotificationsEmail", "r__type": "verification" + }, + { + "name": "{{{prefix}}}verification_NOTupdateNotificationsEmail", + "r__type": "verification" + }, + { + "name": "{{{prefix}}}verification_NOTupdateNotificationsNote", + "r__type": "verification" + }, + { + "name": "{{{prefix}}}verification_clear", + "r__type": "verification" } ], "name": "" diff --git a/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-1f7f8788c560/get-response.json b/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-1f7f8788c560/get-response.json index cb6888112..c147cd7e0 100644 --- a/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-1f7f8788c560/get-response.json +++ b/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-1f7f8788c560/get-response.json @@ -99,6 +99,27 @@ "activityObjectId": "testExisting_verification_updateNotificationsEmail", "objectTypeId": 1000, "displayOrder": 9 + }, + { + "id": "f3774dc2-a271-4a44-8cbe-f630a6d6545e", + "name": "testExisting_dataExtension", + "activityObjectId": "testExisting_verification_NOTupdateNotificationsEmail", + "objectTypeId": 1000, + "displayOrder": 10 + }, + { + "id": "f3774dc2-a271-4a44-8cbe-f630a6d6545e", + "name": "testExisting_dataExtension", + "activityObjectId": "testExisting_verification_NOTupdateNotificationsNote", + "objectTypeId": 1000, + "displayOrder": 11 + }, + { + "id": "f3774dc2-a271-4a44-8cbe-f630a6d6545e", + "name": "testExisting_dataExtension", + "activityObjectId": "testExisting_verification_clear", + "objectTypeId": 1000, + "displayOrder": 12 } ] } diff --git a/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_NOTupdateNotificationsEmail/get-response.json b/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_NOTupdateNotificationsEmail/get-response.json new file mode 100644 index 000000000..356fe53f5 --- /dev/null +++ b/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_NOTupdateNotificationsEmail/get-response.json @@ -0,0 +1,12 @@ +{ + "dataVerificationDefinitionId": "testExisting_verification_NOTupdateNotificationsEmail", + "targetObjectId": "21711373-72c1-ec11-b83b-48df37d1deb7", + "verificationType": "IsEqualTo", + "value1": 1, + "value2": 0, + "shouldStopOnFailure": true, + "shouldEmailOnFailure": false, + "notificationEmailAddress": "", + "notificationEmailMessage": "", + "createdBy": 700301950 +} diff --git a/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_NOTupdateNotificationsEmail/patch-response.json b/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_NOTupdateNotificationsEmail/patch-response.json new file mode 100644 index 000000000..356fe53f5 --- /dev/null +++ b/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_NOTupdateNotificationsEmail/patch-response.json @@ -0,0 +1,12 @@ +{ + "dataVerificationDefinitionId": "testExisting_verification_NOTupdateNotificationsEmail", + "targetObjectId": "21711373-72c1-ec11-b83b-48df37d1deb7", + "verificationType": "IsEqualTo", + "value1": 1, + "value2": 0, + "shouldStopOnFailure": true, + "shouldEmailOnFailure": false, + "notificationEmailAddress": "", + "notificationEmailMessage": "", + "createdBy": 700301950 +} diff --git a/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_NOTupdateNotificationsNote/get-response.json b/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_NOTupdateNotificationsNote/get-response.json new file mode 100644 index 000000000..a2f87058c --- /dev/null +++ b/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_NOTupdateNotificationsNote/get-response.json @@ -0,0 +1,12 @@ +{ + "dataVerificationDefinitionId": "testExisting_verification_NOTupdateNotificationsNote", + "targetObjectId": "21711373-72c1-ec11-b83b-48df37d1deb7", + "verificationType": "IsEqualTo", + "value1": 1, + "value2": 0, + "shouldStopOnFailure": true, + "shouldEmailOnFailure": false, + "notificationEmailAddress": "test@test.com", + "notificationEmailMessage": "test", + "createdBy": 700301950 +} diff --git a/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_NOTupdateNotificationsNote/patch-response.json b/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_NOTupdateNotificationsNote/patch-response.json new file mode 100644 index 000000000..d57a61a13 --- /dev/null +++ b/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_NOTupdateNotificationsNote/patch-response.json @@ -0,0 +1,12 @@ +{ + "dataVerificationDefinitionId": "testExisting_verification_NOTupdateNotificationsEmail", + "targetObjectId": "21711373-72c1-ec11-b83b-48df37d1deb7", + "verificationType": "IsEqualTo", + "value1": 1, + "value2": 0, + "shouldStopOnFailure": true, + "shouldEmailOnFailure": false, + "notificationEmailAddress": "test@test.com", + "notificationEmailMessage": "test", + "createdBy": 700301950 +} diff --git a/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_clear/get-response.json b/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_clear/get-response.json new file mode 100644 index 000000000..18e4fa385 --- /dev/null +++ b/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_clear/get-response.json @@ -0,0 +1,12 @@ +{ + "dataVerificationDefinitionId": "testExisting_verification_clear", + "targetObjectId": "21711373-72c1-ec11-b83b-48df37d1deb7", + "verificationType": "IsEqualTo", + "value1": 1, + "value2": 0, + "shouldStopOnFailure": true, + "shouldEmailOnFailure": false, + "notificationEmailAddress": "test@test.com", + "notificationEmailMessage": "test", + "createdBy": 700301950 +} diff --git a/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_clear/patch-response.json b/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_clear/patch-response.json new file mode 100644 index 000000000..611c8b15b --- /dev/null +++ b/test/resources/9999999/automation/v1/dataverifications/testExisting_verification_clear/patch-response.json @@ -0,0 +1,12 @@ +{ + "dataVerificationDefinitionId": "testExisting_verification_clear", + "targetObjectId": "21711373-72c1-ec11-b83b-48df37d1deb7", + "verificationType": "IsEqualTo", + "value1": 1, + "value2": 0, + "shouldStopOnFailure": true, + "shouldEmailOnFailure": true, + "notificationEmailAddress": "", + "notificationEmailMessage": "", + "createdBy": 700301950 +} diff --git a/test/resources/9999999/verification/NOTupdateNotificationsEmail-expected.json b/test/resources/9999999/verification/NOTupdateNotificationsEmail-expected.json new file mode 100644 index 000000000..40003bb8a --- /dev/null +++ b/test/resources/9999999/verification/NOTupdateNotificationsEmail-expected.json @@ -0,0 +1,11 @@ +{ + "dataVerificationDefinitionId": "testExisting_verification_NOTupdateNotificationsEmail", + "notificationEmailAddress": "", + "notificationEmailMessage": "", + "r__dataExtension_CustomerKey": "testExisting_dataExtension", + "shouldEmailOnFailure": false, + "shouldStopOnFailure": true, + "value1": 1, + "value2": 0, + "verificationType": "IsEqualTo" +} diff --git a/test/mockRoot/deploy/testInstance/testBU/verification/testExisting_verification_updateNotificationsEmail.verification-meta.json b/test/resources/9999999/verification/clear-expected.json similarity index 75% rename from test/mockRoot/deploy/testInstance/testBU/verification/testExisting_verification_updateNotificationsEmail.verification-meta.json rename to test/resources/9999999/verification/clear-expected.json index 929f3bc41..f587fba89 100644 --- a/test/mockRoot/deploy/testInstance/testBU/verification/testExisting_verification_updateNotificationsEmail.verification-meta.json +++ b/test/resources/9999999/verification/clear-expected.json @@ -1,5 +1,5 @@ -{ - "dataVerificationDefinitionId": "testExisting_verification_updateNotificationsEmail", +{ + "dataVerificationDefinitionId": "testExisting_verification_clear", "notificationEmailAddress": "", "notificationEmailMessage": "", "r__dataExtension_CustomerKey": "testExisting_dataExtension", diff --git a/test/type.automation.test.js b/test/type.automation.test.js index 1ccf9dbb9..37c148ec8 100644 --- a/test/type.automation.test.js +++ b/test/type.automation.test.js @@ -49,7 +49,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 50, + 53, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -122,7 +122,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 42, + 45, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -191,7 +191,7 @@ describe('type: automation', () => { assert.equal( testUtils.getAPIHistoryLength(), - 50, + 53, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -259,7 +259,7 @@ describe('type: automation', () => { assert.equal( testUtils.getAPIHistoryLength(), - 46, + 49, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -295,7 +295,7 @@ describe('type: automation', () => { // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), - 35, + 41, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -339,7 +339,7 @@ describe('type: automation', () => { // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), - 74, + 80, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -383,7 +383,7 @@ describe('type: automation', () => { // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), - 76, + 82, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -427,7 +427,7 @@ describe('type: automation', () => { // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), - 77, + 83, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -467,7 +467,7 @@ describe('type: automation', () => { // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), - 69, + 75, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -508,7 +508,7 @@ describe('type: automation', () => { // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), - 75, + 81, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -549,7 +549,7 @@ describe('type: automation', () => { // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), - 77, + 83, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -600,7 +600,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 37, + 40, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -651,7 +651,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 35, + 41, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -924,7 +924,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 38, + 41, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -960,7 +960,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 38, + 41, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -996,7 +996,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 38, + 41, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -1032,7 +1032,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 38, + 41, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -1068,7 +1068,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 38, + 41, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -1110,7 +1110,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 38, + 41, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -1150,7 +1150,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 38, + 41, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -1190,7 +1190,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 38, + 41, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -1232,7 +1232,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 38, + 41, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -1270,7 +1270,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 38, + 41, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -1306,7 +1306,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 38, + 41, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -1396,7 +1396,7 @@ describe('type: automation', () => { assert.equal( testUtils.getAPIHistoryLength(), - 38, + 41, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -1432,7 +1432,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 38, + 41, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -1468,7 +1468,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 38, + 41, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -1500,7 +1500,7 @@ describe('type: automation', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 38, + 41, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; diff --git a/test/type.query.test.js b/test/type.query.test.js index 276e15ba1..a96d47a21 100644 --- a/test/type.query.test.js +++ b/test/type.query.test.js @@ -458,7 +458,7 @@ describe('type: query', () => { // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), - 66, + 69, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -498,7 +498,7 @@ describe('type: query', () => { // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), - 68, + 71, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; diff --git a/test/type.verification.test.js b/test/type.verification.test.js index 5b3a4537a..2d0dc4d58 100644 --- a/test/type.verification.test.js +++ b/test/type.verification.test.js @@ -24,15 +24,15 @@ describe('type: verification', () => { const result = cache.getCache(); assert.equal( result.verification ? Object.keys(result.verification).length : 0, - 3, - 'only 3 verifications expected' + 6, + 'only 6 verifications expected' ); assert.equal( retrieved['testInstance/testBU']?.verification ? Object.keys(retrieved['testInstance/testBU']?.verification).length : 0, - 3, - '3 verifications to be retrieved' + 6, + '6 verifications to be retrieved' ); assert.deepEqual( @@ -45,7 +45,7 @@ describe('type: verification', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 26, + 29, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -65,15 +65,15 @@ describe('type: verification', () => { const result = cache.getCache(); assert.equal( result.verification ? Object.keys(result.verification).length : 0, - 4, - '4 verifications expected' + 7, + '7 verifications expected' ); assert.equal( deployed['testInstance/testBU']?.verification ? Object.keys(deployed['testInstance/testBU']?.verification).length : 0, - 3, - '3 verifications to be deployed' + 2, + '2 verifications to be deployed' ); // confirm created item assert.deepEqual( @@ -93,7 +93,7 @@ describe('type: verification', () => { // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), - 29, + 31, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -146,7 +146,7 @@ describe('type: verification', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 26, + 29, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -188,8 +188,8 @@ describe('type: verification', () => { const result = cache.getCache(); assert.equal( result.verification ? Object.keys(result.verification).length : 0, - 3, - 'only one verification expected' + 6, + 'only 6 verification expected' ); assert.equal( updatedNotifications['testInstance/testBU'].length, @@ -210,7 +210,7 @@ describe('type: verification', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 31, + 34, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -229,8 +229,8 @@ describe('type: verification', () => { const result = cache.getCache(); assert.equal( result.verification ? Object.keys(result.verification).length : 0, - 3, - 'only 3 verifications expected' + 6, + 'only 6 verifications expected' ); assert.equal( updatedNotifications['testInstance/testBU'].length, @@ -251,7 +251,111 @@ describe('type: verification', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 31, + 34, + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + ); + return; + }); + it('Should NOT update notification email', async () => { + handler.setOptions({ completionEmail: 'notAnEmail' }); + // WHEN + const updatedNotifications = await handler.updateNotifications( + 'testInstance/testBU', + 'verification', + ['testExisting_verification_NOTupdateNotificationsEmail'] + ); + // THEN + assert.equal(process.exitCode, false, 'retrieve should not have thrown an error'); + // get results from cache + const result = cache.getCache(); + assert.equal( + result.verification ? Object.keys(result.verification).length : 0, + 6, + 'only 6 verification expected' + ); + assert.equal( + updatedNotifications['testInstance/testBU'].length, + 1, + 'one automation key expected' + ); + assert.deepEqual( + await testUtils.getActualJson( + 'testExisting_verification_NOTupdateNotificationsEmail', + 'verification' + ), + await testUtils.getExpectedJson( + '9999999', + 'verification', + 'NOTupdateNotificationsEmail' + ), + 'returned metadata was not equal expected for update query' + ); + assert.equal( + testUtils.getAPIHistoryLength(), + 34, + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + ); + return; + }); + it('Should NOT update notification note', async () => { + handler.setOptions({ completionNote: 'test' }); + // WHEN + const updatedNotifications = await handler.updateNotifications( + 'testInstance/testBU', + 'verification', + ['testExisting_verification_NOTupdateNotificationsNote'] + ); + // THEN + assert.equal(process.exitCode, false, 'retrieve should not have thrown an error'); + // get results from cache + const result = cache.getCache(); + assert.equal( + result.verification ? Object.keys(result.verification).length : 0, + 1, + 'only 1 verifications expected' + ); + assert.equal( + updatedNotifications['testInstance/testBU'].length, + 0, + '0 automation key expected' + ); + assert.equal( + testUtils.getAPIHistoryLength(), + 4, + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + ); + return; + }); + it('Should clear notifications', async () => { + handler.setOptions({ clear: 'true' }); + // WHEN + const updatedNotifications = await handler.updateNotifications( + 'testInstance/testBU', + 'verification', + ['testExisting_verification_clear'] + ); + // THEN + assert.equal(process.exitCode, false, 'retrieve should not have thrown an error'); + // get results from cache + const result = cache.getCache(); + assert.equal( + result.verification ? Object.keys(result.verification).length : 0, + 6, + 'only 6 verifications expected' + ); + assert.equal( + updatedNotifications['testInstance/testBU'].length, + 1, + '1 automation key expected' + ); + assert.deepEqual( + await testUtils.getActualJson('testExisting_verification_clear', 'verification'), + await testUtils.getExpectedJson('9999999', 'verification', 'clear'), + 'returned metadata was not equal expected for update query' + ); + assert.equal( + testUtils.getAPIHistoryLength(), + 34, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return;