From 9cedea60902c39b97f9e071632bbb10f1d2e8bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Thu, 9 Jan 2025 15:41:26 +0100 Subject: [PATCH] #1923: test cases for auto-refreshing journeys upon publish --- test/type.journey.test.js | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/test/type.journey.test.js b/test/type.journey.test.js index 118cba11e..25286b81f 100644 --- a/test/type.journey.test.js +++ b/test/type.journey.test.js @@ -524,7 +524,7 @@ describe('type: journey', () => { }); describe('Publish ================', () => { - it(`Should not publish a transactional journey by key that is already published`, async () => { + it(`Should not publish a transactional journey by key that is already published but instead trigger a refresh`, async () => { handler.setOptions({ skipStatusCheck: true }); // WHEN const publish = await handler.publish( @@ -533,17 +533,41 @@ describe('type: journey', () => { ['testExisting_temail'] ); // THEN - assert.equal(process.exitCode, 1, 'publish should have thrown an error'); + assert.equal(process.exitCode, 0, 'publish should not have thrown an error'); assert.deepEqual( publish['testInstance/testBU']?.journey, - [], - 'should have not have published any journey' + ['testExisting_temail'], + 'should not have published any journey but instead triggered a refresh' + ); + + // get callouts + const pauseCallout = testUtils.getRestCallout( + 'post', + '/interaction/v1/interactions/transactional/pause' + ); + const resumeCallout = testUtils.getRestCallout( + 'post', + '/interaction/v1/interactions/transactional/resume' + ); + const pauseResumeResponse = { + definitionId: 'dsfdsafdsa-922c-4568-85a5-e5cc77efc3be', + }; + // confirm responses + assert.deepEqual( + pauseCallout, + pauseResumeResponse, + 'pause-payload JSON was not equal expected' + ); + assert.deepEqual( + resumeCallout, + pauseResumeResponse, + 'resume-payload JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), - 1, + 4, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return;