-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#60: test case for retrieving deliveryProfile
- Loading branch information
1 parent
ebffd18
commit 9ea07ec
Showing
3 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"key": "Default", | ||
"createdDate": "2021-06-21T17:55:00Z", | ||
"lastUpdated": "2021-06-21T17:55:00Z", | ||
"name": "Default", | ||
"description": "Account defaults" | ||
} |
15 changes: 15 additions & 0 deletions
15
test/resources/9999999/legacy/v1/beta/messaging/deliverypolicy/get-response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}); | ||
}); | ||
}); |