diff --git a/test/resources/9999999/deliveryProfile/get-expected.json b/test/resources/9999999/deliveryProfile/get-expected.json new file mode 100644 index 000000000..d36d9bdf9 --- /dev/null +++ b/test/resources/9999999/deliveryProfile/get-expected.json @@ -0,0 +1,7 @@ +{ + "key": "Default", + "createdDate": "2021-06-21T17:55:00Z", + "lastUpdated": "2021-06-21T17:55:00Z", + "name": "Default", + "description": "Account defaults" +} diff --git a/test/resources/9999999/legacy/v1/beta/messaging/deliverypolicy/get-response.json b/test/resources/9999999/legacy/v1/beta/messaging/deliverypolicy/get-response.json new file mode 100644 index 000000000..39ebac4f0 --- /dev/null +++ b/test/resources/9999999/legacy/v1/beta/messaging/deliverypolicy/get-response.json @@ -0,0 +1,15 @@ +{ + "startIndex": 0, + "itemsPerPage": 50, + "totalResults": 1, + "entry": [ + { + "id": "ejQ1Y2Q5SzVFZXU0UHZRRFE4bFptQTo0ODow", + "key": "Default", + "createdDate": "2021-06-21T17:55:00Z", + "lastUpdated": "2021-06-21T17:55:00Z", + "name": "Default", + "description": "Account defaults" + } + ] +} diff --git a/test/type.deliveryProfile.test.js b/test/type.deliveryProfile.test.js new file mode 100644 index 000000000..8a38f7711 --- /dev/null +++ b/test/type.deliveryProfile.test.js @@ -0,0 +1,45 @@ +import * as chai from 'chai'; +const assert = chai.assert; + +import chaiFiles from 'chai-files'; +import cache from '../lib/util/cache.js'; +import * as testUtils from './utils.js'; +import handler from '../lib/index.js'; +chai.use(chaiFiles); + +describe('type: deliveryProfile', () => { + beforeEach(() => { + testUtils.mockSetup(); + }); + + afterEach(() => { + testUtils.mockReset(); + }); + + describe('Retrieve ================', () => { + it('Should retrieve a deliveryProfile', async () => { + // WHEN + await handler.retrieve('testInstance/testBU', ['deliveryProfile']); + // THEN + assert.equal(process.exitCode, 0, 'retrieve should not have thrown an error'); + // get results from cache + const result = cache.getCache(); + assert.equal( + result.deliveryProfile ? Object.keys(result.deliveryProfile).length : 0, + 1, + 'only one deliveryProfile expected' + ); + assert.deepEqual( + await testUtils.getActualJson('Default', 'deliveryProfile'), + await testUtils.getExpectedJson('9999999', 'deliveryProfile', 'get'), + 'returned JSON was not equal expected' + ); + assert.equal( + testUtils.getAPIHistoryLength(), + 1, + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + ); + return; + }); + }); +});