-
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.
#846: add RETRIEVE test for type dataExtract
- Loading branch information
1 parent
b6ecf31
commit d599a58
Showing
3 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
test/resources/9999999/automation/v1/dataextracttypes/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,50 @@ | ||
[ | ||
{ | ||
"name": "Audit Trail Activity Log", | ||
"extractId": "d804ddf9-feda-4495-8e7e-069a14f5d248" | ||
}, | ||
{ | ||
"name": "Zip", | ||
"extractId": "9a487c7d-96bd-484c-ad80-0f0bcbb91ca7" | ||
}, | ||
{ | ||
"name": "Tracking Extract", | ||
"extractId": "c7219016-a7f0-4c72-8657-1ec12c28a0db" | ||
}, | ||
{ | ||
"name": "Mobile Push Detail Extract Report", | ||
"extractId": "e6647310-ac95-4f32-a639-2a6b145c83f1" | ||
}, | ||
{ | ||
"name": "UTF16 to ASCII Converter", | ||
"extractId": "e7e14f95-b925-462d-b6b4-4a6b1dca7ca1" | ||
}, | ||
{ | ||
"name": "Contacts Without Channel Addresses", | ||
"extractId": "f2500d28-b3cb-42b9-ad31-361123ec1222" | ||
}, | ||
{ | ||
"name": "Convert XML", | ||
"extractId": "805dfb29-82cb-43dc-989b-53ef5d181920" | ||
}, | ||
{ | ||
"name": "GZip", | ||
"extractId": "7e7d322a-88ca-499a-9fb3-90e72fcf00af" | ||
}, | ||
{ | ||
"name": "XmlToTextMapper", | ||
"extractId": "cf2cd221-fc3c-4d9f-90b4-a4e879a51ab6" | ||
}, | ||
{ | ||
"name": "Enhanced FTP File Move and Copy", | ||
"extractId": "90d90e0a-fd9a-4d35-b471-cde0d17c91d4" | ||
}, | ||
{ | ||
"name": "Data Extension Extract", | ||
"extractId": "bb94a04d-9632-4623-be47-daabc3f588a6" | ||
}, | ||
{ | ||
"name": "Audit Trail Access Log", | ||
"extractId": "382b94bd-bd1b-45e1-864f-eb824841885a" | ||
} | ||
] |
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,39 @@ | ||
{ | ||
"createdBy": 700301950, | ||
"createdDate": "2022-11-09T05:31:21.667", | ||
"dataFields": [ | ||
{ | ||
"name": "ColumnDelimiter", | ||
"type": "string", | ||
"value": "," | ||
}, | ||
{ | ||
"name": "DECustomerKey", | ||
"type": "string", | ||
"value": "testExisting_dataExtension" | ||
}, | ||
{ | ||
"name": "HasColumnHeaders", | ||
"type": "bool", | ||
"value": "False" | ||
}, | ||
{ | ||
"name": "TextQualified", | ||
"type": "bool", | ||
"value": "False" | ||
}, | ||
{ | ||
"name": "UsesLineFeed", | ||
"type": "bool", | ||
"value": "False" | ||
} | ||
], | ||
"description": "blabla", | ||
"fileSpec": "testExisting-%%Year%%-%%Month%%-%%Day%%", | ||
"intervalType": 0, | ||
"key": "testExisting_dataExtract", | ||
"modifiedBy": 700301950, | ||
"modifiedDate": "2022-11-17T07:13:36.9", | ||
"name": "testExisting_dataExtract", | ||
"r__dataExtractType_name": "Data Extension Extract" | ||
} |
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,43 @@ | ||
const chai = require('chai'); | ||
const chaiFiles = require('chai-files'); | ||
const assert = chai.assert; | ||
chai.use(chaiFiles); | ||
const cache = require('../lib/util/cache'); | ||
const testUtils = require('./utils'); | ||
const handler = require('../lib/index'); | ||
|
||
describe('type: dataExtract', () => { | ||
beforeEach(() => { | ||
testUtils.mockSetup(); | ||
}); | ||
afterEach(() => { | ||
testUtils.mockReset(); | ||
}); | ||
|
||
describe('Retrieve ================', () => { | ||
it('Should retrieve a dataExtract', async () => { | ||
// WHEN | ||
await handler.retrieve('testInstance/testBU', ['dataExtract']); | ||
// THEN | ||
assert.equal(process.exitCode, false, 'retrieve should not have thrown an error'); | ||
// get results from cache | ||
const result = cache.getCache(); | ||
assert.equal( | ||
result.dataExtract ? Object.keys(result.dataExtract).length : 0, | ||
1, | ||
'only one dataExtract expected' | ||
); | ||
assert.deepEqual( | ||
await testUtils.getActualJson('testExisting_dataExtract', 'dataExtract'), | ||
await testUtils.getExpectedJson('9999999', 'dataExtract', 'get'), | ||
'returned JSON was not equal expected' | ||
); | ||
assert.equal( | ||
testUtils.getAPIHistoryLength(), | ||
6, | ||
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' | ||
); | ||
return; | ||
}); | ||
}); | ||
}); |