mcdev 8.3.1 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/ISSUE_TEMPLATE/bug.yml +2 -0
- package/.github/workflows/close_issues_on_merge.yml +4 -0
- package/.github/workflows/code-test.yml +2 -2
- package/.github/workflows/coverage-base-update.yml +2 -2
- package/.github/workflows/coverage-develop-branch.yml +1 -1
- package/.github/workflows/coverage-main-branch.yml +1 -1
- package/.github/workflows/coverage.yml +2 -2
- package/.prettierrc +1 -1
- package/@types/lib/index.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Asset.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Automation.d.ts.map +1 -1
- package/@types/lib/metadataTypes/DataExtension.d.ts.map +1 -1
- package/@types/lib/metadataTypes/DataFilter.d.ts +1 -0
- package/@types/lib/metadataTypes/DataFilter.d.ts.map +1 -1
- package/@types/lib/metadataTypes/DataFilterHidden.d.ts +1 -0
- package/@types/lib/metadataTypes/DataFilterHidden.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Event.d.ts.map +1 -1
- package/@types/lib/metadataTypes/FileLocation.d.ts +74 -0
- package/@types/lib/metadataTypes/FileLocation.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Folder.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Journey.d.ts +6 -0
- package/@types/lib/metadataTypes/Journey.d.ts.map +1 -1
- package/@types/lib/metadataTypes/List.d.ts +1 -1
- package/@types/lib/metadataTypes/MetadataType.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Script.d.ts +14 -0
- package/@types/lib/metadataTypes/Script.d.ts.map +1 -1
- package/@types/lib/metadataTypes/definitions/DataFilter.definition.d.ts +1 -0
- package/@types/lib/metadataTypes/definitions/DataFilterHidden.definition.d.ts +1 -0
- package/@types/lib/metadataTypes/definitions/FileLocation.definition.d.ts +62 -4
- package/@types/lib/metadataTypes/definitions/Journey.definition.d.ts +6 -0
- package/@types/lib/metadataTypes/definitions/Script.definition.d.ts +10 -0
- package/@types/lib/util/auth.d.ts.map +1 -1
- package/@types/lib/util/cli.d.ts.map +1 -1
- package/@types/lib/util/file.d.ts.map +1 -1
- package/@types/lib/util/init.config.d.ts.map +1 -1
- package/@types/lib/util/init.d.ts +1 -1
- package/@types/lib/util/init.d.ts.map +1 -1
- package/@types/lib/util/init.git.d.ts.map +1 -1
- package/lib/Deployer.js +3 -3
- package/lib/cli.js +6 -0
- package/lib/index.js +15 -14
- package/lib/metadataTypes/Asset.js +7 -8
- package/lib/metadataTypes/Automation.js +8 -10
- package/lib/metadataTypes/DataExtension.js +4 -3
- package/lib/metadataTypes/DataExtensionField.js +3 -3
- package/lib/metadataTypes/DataFilter.js +36 -22
- package/lib/metadataTypes/Event.js +8 -7
- package/lib/metadataTypes/FileLocation.js +204 -4
- package/lib/metadataTypes/Folder.js +8 -7
- package/lib/metadataTypes/Journey.js +74 -47
- package/lib/metadataTypes/List.js +1 -1
- package/lib/metadataTypes/MetadataType.js +17 -21
- package/lib/metadataTypes/Script.js +16 -0
- package/lib/metadataTypes/User.js +2 -2
- package/lib/metadataTypes/definitions/DataFilter.definition.js +1 -0
- package/lib/metadataTypes/definitions/DataFilterHidden.definition.js +1 -0
- package/lib/metadataTypes/definitions/FileLocation.definition.js +52 -7
- package/lib/metadataTypes/definitions/Journey.definition.js +6 -0
- package/lib/metadataTypes/definitions/Script.definition.js +6 -0
- package/lib/util/auth.js +20 -24
- package/lib/util/businessUnit.js +1 -1
- package/lib/util/cli.js +2 -1
- package/lib/util/file.js +2 -1
- package/lib/util/init.config.js +3 -1
- package/lib/util/init.git.js +2 -1
- package/lib/util/init.js +2 -1
- package/lib/util/util.js +3 -3
- package/package.json +21 -21
- package/test/general.test.js +11 -11
- package/test/mockRoot/.mcdevrc.json +1 -1
- package/test/mockRoot/deploy/testInstance/testBU/fileLocation/ExactTarget Enhanced FTP.fileLocation-meta.json +5 -0
- package/test/mockRoot/deploy/testInstance/testBU/fileLocation/testExisting_fileLocation_aws.fileLocation-meta.json +14 -0
- package/test/mockRoot/deploy/testInstance/testBU/fileLocation/testExisting_fileLocation_exsftp.fileLocation-meta.json +12 -0
- package/test/resourceFactory.js +10 -3
- package/test/resources/9999999/automation/v1/ftplocations/get-response.json +26 -1
- package/test/resources/9999999/automation/v1/scripts/39f6a488-20eb-4ba0-b0b9-023725b574e4/get-response.json +10 -0
- package/test/resources/9999999/automation/v1/scripts/39f6a488-20eb-4ba0-b0b9-023725b574e4/patch-response.json +2 -2
- package/test/resources/9999999/data/v1/filetransferlocation/Salesforce%20Objects%20%26%20Reports/get-response.json +4 -0
- package/test/resources/9999999/data/v1/filetransferlocation/testExisting_fileLocation_aws/patch-response.json +18 -0
- package/test/resources/9999999/data/v1/filetransferlocation/testExisting_fileLocation_azure/delete-response.json +4 -0
- package/test/resources/9999999/data/v1/filetransferlocation/testExisting_fileLocation_azure/get-response.json +18 -0
- package/test/resources/9999999/data/v1/filetransferlocation/testExisting_fileLocation_exsftp/patch-response.json +16 -0
- package/test/resources/9999999/data/v1/filetransferlocations/get-response.json +59 -0
- package/test/resources/9999999/fileLocation/build-expected.json +14 -0
- package/test/resources/9999999/fileLocation/get-aws-expected.json +14 -0
- package/test/resources/9999999/fileLocation/get-azure-expected.json +14 -0
- package/test/resources/9999999/fileLocation/get-eftp-expected.json +5 -0
- package/test/resources/9999999/fileLocation/get-exsftp-expected.json +12 -0
- package/test/resources/9999999/fileLocation/get-gcp-expected.json +10 -0
- package/test/resources/9999999/fileLocation/get-sor-expected.json +5 -0
- package/test/resources/9999999/fileLocation/patch-aws-expected.json +14 -0
- package/test/resources/9999999/fileLocation/patch-exsftp-expected.json +12 -0
- package/test/resources/9999999/fileLocation/template-expected.json +14 -0
- package/test/resources/9999999/interaction/v1/interactions/get-response-status=Published.json +40 -0
- package/test/type.automation.test.js +14 -14
- package/test/type.dataFilter.test.js +10 -2
- package/test/type.fileLocation.test.js +279 -0
- package/test/type.fileTransfer.test.js +4 -4
- package/test/type.filter.test.js +9 -2
- package/test/type.importFile.test.js +5 -5
- package/test/type.journey.test.js +26 -0
- package/test/type.query.test.js +2 -2
- package/test/type.script.test.js +1 -1
- package/tsconfig.json +1 -1
- package/tsconfig.npmScripts.json +1 -1
- package/tsconfig.precommit.json +1 -1
|
@@ -58,7 +58,7 @@ describe('type: automation', () => {
|
|
|
58
58
|
);
|
|
59
59
|
assert.equal(
|
|
60
60
|
testUtils.getAPIHistoryLength(),
|
|
61
|
-
|
|
61
|
+
34,
|
|
62
62
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
63
63
|
);
|
|
64
64
|
return;
|
|
@@ -144,7 +144,7 @@ describe('type: automation', () => {
|
|
|
144
144
|
|
|
145
145
|
assert.equal(
|
|
146
146
|
testUtils.getAPIHistoryLength(),
|
|
147
|
-
|
|
147
|
+
52,
|
|
148
148
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
149
149
|
);
|
|
150
150
|
return;
|
|
@@ -212,7 +212,7 @@ describe('type: automation', () => {
|
|
|
212
212
|
|
|
213
213
|
assert.equal(
|
|
214
214
|
testUtils.getAPIHistoryLength(),
|
|
215
|
-
|
|
215
|
+
56,
|
|
216
216
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
217
217
|
);
|
|
218
218
|
return;
|
|
@@ -279,7 +279,7 @@ describe('type: automation', () => {
|
|
|
279
279
|
|
|
280
280
|
assert.equal(
|
|
281
281
|
testUtils.getAPIHistoryLength(),
|
|
282
|
-
|
|
282
|
+
56,
|
|
283
283
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
284
284
|
);
|
|
285
285
|
return;
|
|
@@ -318,7 +318,7 @@ describe('type: automation', () => {
|
|
|
318
318
|
// check number of API calls
|
|
319
319
|
assert.equal(
|
|
320
320
|
testUtils.getAPIHistoryLength(),
|
|
321
|
-
|
|
321
|
+
28,
|
|
322
322
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
323
323
|
);
|
|
324
324
|
return;
|
|
@@ -362,7 +362,7 @@ describe('type: automation', () => {
|
|
|
362
362
|
// check number of API calls
|
|
363
363
|
assert.equal(
|
|
364
364
|
testUtils.getAPIHistoryLength(),
|
|
365
|
-
|
|
365
|
+
74,
|
|
366
366
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
367
367
|
);
|
|
368
368
|
return;
|
|
@@ -406,7 +406,7 @@ describe('type: automation', () => {
|
|
|
406
406
|
// check number of API calls
|
|
407
407
|
assert.equal(
|
|
408
408
|
testUtils.getAPIHistoryLength(),
|
|
409
|
-
|
|
409
|
+
76,
|
|
410
410
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
411
411
|
);
|
|
412
412
|
return;
|
|
@@ -450,7 +450,7 @@ describe('type: automation', () => {
|
|
|
450
450
|
// check number of API calls
|
|
451
451
|
assert.equal(
|
|
452
452
|
testUtils.getAPIHistoryLength(),
|
|
453
|
-
|
|
453
|
+
76,
|
|
454
454
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
455
455
|
);
|
|
456
456
|
return;
|
|
@@ -494,7 +494,7 @@ describe('type: automation', () => {
|
|
|
494
494
|
// check number of API calls
|
|
495
495
|
assert.equal(
|
|
496
496
|
testUtils.getAPIHistoryLength(),
|
|
497
|
-
|
|
497
|
+
69,
|
|
498
498
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
499
499
|
);
|
|
500
500
|
return;
|
|
@@ -538,7 +538,7 @@ describe('type: automation', () => {
|
|
|
538
538
|
// check number of API calls
|
|
539
539
|
assert.equal(
|
|
540
540
|
testUtils.getAPIHistoryLength(),
|
|
541
|
-
|
|
541
|
+
76,
|
|
542
542
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
543
543
|
);
|
|
544
544
|
return;
|
|
@@ -582,7 +582,7 @@ describe('type: automation', () => {
|
|
|
582
582
|
// check number of API calls
|
|
583
583
|
assert.equal(
|
|
584
584
|
testUtils.getAPIHistoryLength(),
|
|
585
|
-
|
|
585
|
+
76,
|
|
586
586
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
587
587
|
);
|
|
588
588
|
return;
|
|
@@ -626,7 +626,7 @@ describe('type: automation', () => {
|
|
|
626
626
|
);
|
|
627
627
|
assert.equal(
|
|
628
628
|
testUtils.getAPIHistoryLength(),
|
|
629
|
-
|
|
629
|
+
30,
|
|
630
630
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
631
631
|
);
|
|
632
632
|
return;
|
|
@@ -670,7 +670,7 @@ describe('type: automation', () => {
|
|
|
670
670
|
);
|
|
671
671
|
assert.equal(
|
|
672
672
|
testUtils.getAPIHistoryLength(),
|
|
673
|
-
|
|
673
|
+
34,
|
|
674
674
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
675
675
|
);
|
|
676
676
|
return;
|
|
@@ -681,7 +681,7 @@ describe('type: automation', () => {
|
|
|
681
681
|
await handler.retrieve('testInstance/testBU');
|
|
682
682
|
assert.equal(process.exitCode, 0, 'retrieve should not have thrown an error');
|
|
683
683
|
|
|
684
|
-
const expectedApiCallsRetrieve =
|
|
684
|
+
const expectedApiCallsRetrieve = 109;
|
|
685
685
|
assert.equal(
|
|
686
686
|
testUtils.getAPIHistoryLength(),
|
|
687
687
|
expectedApiCallsRetrieve,
|
|
@@ -81,7 +81,7 @@ describe('type: dataFilter', () => {
|
|
|
81
81
|
it('Should create & upsert a dataFilter', async () => {
|
|
82
82
|
// WHEN
|
|
83
83
|
|
|
84
|
-
await handler.deploy('testInstance/testBU', ['dataFilter']);
|
|
84
|
+
const deployed = await handler.deploy('testInstance/testBU', ['dataFilter']);
|
|
85
85
|
// THEN
|
|
86
86
|
assert.equal(process.exitCode, 0, 'deploy should not have thrown an error');
|
|
87
87
|
// get results from cache
|
|
@@ -89,8 +89,16 @@ describe('type: dataFilter', () => {
|
|
|
89
89
|
assert.equal(
|
|
90
90
|
result.dataFilter ? Object.keys(result.dataFilter).length : 0,
|
|
91
91
|
2,
|
|
92
|
-
'
|
|
92
|
+
'unexpected number of dataFilters in cache'
|
|
93
93
|
);
|
|
94
|
+
assert.equal(
|
|
95
|
+
deployed?.['testInstance/testBU']?.dataFilter
|
|
96
|
+
? Object.keys(deployed['testInstance/testBU'].dataFilter).length
|
|
97
|
+
: 0,
|
|
98
|
+
2,
|
|
99
|
+
'unexpected number of dataFilters deployed'
|
|
100
|
+
);
|
|
101
|
+
|
|
94
102
|
// confirm created item
|
|
95
103
|
assert.deepEqual(
|
|
96
104
|
await testUtils.getActualJson('testNew_dataFilter', 'dataFilter'),
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import * as chai from 'chai';
|
|
2
|
+
const assert = chai.assert;
|
|
3
|
+
|
|
4
|
+
import chaiFiles from 'chai-files';
|
|
5
|
+
import cache from '../lib/util/cache.js';
|
|
6
|
+
import * as testUtils from './utils.js';
|
|
7
|
+
import handler from '../lib/index.js';
|
|
8
|
+
chai.use(chaiFiles);
|
|
9
|
+
|
|
10
|
+
describe('type: fileLocation', () => {
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
testUtils.mockSetup();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
testUtils.mockReset();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
describe('Retrieve ================', () => {
|
|
20
|
+
it('Should retrieve a fileLocation', async () => {
|
|
21
|
+
// WHEN
|
|
22
|
+
await handler.retrieve('testInstance/testBU', ['fileLocation']);
|
|
23
|
+
// THEN
|
|
24
|
+
assert.equal(process.exitCode, 0, 'retrieve should not have thrown an error');
|
|
25
|
+
// get results from cache
|
|
26
|
+
const result = cache.getCache();
|
|
27
|
+
assert.equal(
|
|
28
|
+
result.fileLocation ? Object.keys(result.fileLocation).length : 0,
|
|
29
|
+
6,
|
|
30
|
+
'unexpected number of fileLocations'
|
|
31
|
+
);
|
|
32
|
+
assert.deepEqual(
|
|
33
|
+
await testUtils.getActualJson('Salesforce Objects %26 Reports', 'fileLocation'),
|
|
34
|
+
await testUtils.getExpectedJson('9999999', 'fileLocation', 'get-sor'),
|
|
35
|
+
'returned JSON was not equal expected'
|
|
36
|
+
);
|
|
37
|
+
assert.deepEqual(
|
|
38
|
+
await testUtils.getActualJson('ExactTarget Enhanced FTP', 'fileLocation'),
|
|
39
|
+
await testUtils.getExpectedJson('9999999', 'fileLocation', 'get-eftp'),
|
|
40
|
+
'returned JSON was not equal expected'
|
|
41
|
+
);
|
|
42
|
+
assert.deepEqual(
|
|
43
|
+
await testUtils.getActualJson('testExisting_fileLocation_gcp', 'fileLocation'),
|
|
44
|
+
await testUtils.getExpectedJson('9999999', 'fileLocation', 'get-gcp'),
|
|
45
|
+
'returned JSON was not equal expected'
|
|
46
|
+
);
|
|
47
|
+
assert.deepEqual(
|
|
48
|
+
await testUtils.getActualJson('testExisting_fileLocation_azure', 'fileLocation'),
|
|
49
|
+
await testUtils.getExpectedJson('9999999', 'fileLocation', 'get-azure'),
|
|
50
|
+
'returned JSON was not equal expected'
|
|
51
|
+
);
|
|
52
|
+
assert.deepEqual(
|
|
53
|
+
await testUtils.getActualJson('testExisting_fileLocation_aws', 'fileLocation'),
|
|
54
|
+
await testUtils.getExpectedJson('9999999', 'fileLocation', 'get-aws'),
|
|
55
|
+
'returned JSON was not equal expected'
|
|
56
|
+
);
|
|
57
|
+
assert.deepEqual(
|
|
58
|
+
await testUtils.getActualJson('testExisting_fileLocation_exsftp', 'fileLocation'),
|
|
59
|
+
await testUtils.getExpectedJson('9999999', 'fileLocation', 'get-exsftp'),
|
|
60
|
+
'returned JSON was not equal expected'
|
|
61
|
+
);
|
|
62
|
+
assert.equal(
|
|
63
|
+
testUtils.getAPIHistoryLength(),
|
|
64
|
+
2,
|
|
65
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
66
|
+
);
|
|
67
|
+
return;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('Should retrieve an old fileLocation by key', async () => {
|
|
71
|
+
// WHEN
|
|
72
|
+
await handler.retrieve(
|
|
73
|
+
'testInstance/testBU',
|
|
74
|
+
['fileLocation'],
|
|
75
|
+
['Salesforce Objects & Reports']
|
|
76
|
+
);
|
|
77
|
+
// THEN
|
|
78
|
+
assert.equal(process.exitCode, 0, 'retrieve should not have thrown an error');
|
|
79
|
+
// get results from cache
|
|
80
|
+
const result = cache.getCache();
|
|
81
|
+
assert.equal(
|
|
82
|
+
result.fileLocation ? Object.keys(result.fileLocation).length : 0,
|
|
83
|
+
1,
|
|
84
|
+
'unexpected number of fileLocations'
|
|
85
|
+
);
|
|
86
|
+
assert.deepEqual(
|
|
87
|
+
await testUtils.getActualJson('Salesforce Objects %26 Reports', 'fileLocation'),
|
|
88
|
+
await testUtils.getExpectedJson('9999999', 'fileLocation', 'get-sor'),
|
|
89
|
+
'returned JSON was not equal expected'
|
|
90
|
+
);
|
|
91
|
+
assert.equal(
|
|
92
|
+
testUtils.getAPIHistoryLength(),
|
|
93
|
+
2,
|
|
94
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
95
|
+
);
|
|
96
|
+
return;
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('Should retrieve a new fileLocation by key', async () => {
|
|
100
|
+
// WHEN
|
|
101
|
+
await handler.retrieve(
|
|
102
|
+
'testInstance/testBU',
|
|
103
|
+
['fileLocation'],
|
|
104
|
+
['testExisting_fileLocation_azure']
|
|
105
|
+
);
|
|
106
|
+
// THEN
|
|
107
|
+
assert.equal(process.exitCode, 0, 'retrieve should not have thrown an error');
|
|
108
|
+
// get results from cache
|
|
109
|
+
const result = cache.getCache();
|
|
110
|
+
assert.equal(
|
|
111
|
+
result.fileLocation ? Object.keys(result.fileLocation).length : 0,
|
|
112
|
+
1,
|
|
113
|
+
'unexpected number of fileLocations'
|
|
114
|
+
);
|
|
115
|
+
assert.deepEqual(
|
|
116
|
+
await testUtils.getActualJson('testExisting_fileLocation_azure', 'fileLocation'),
|
|
117
|
+
await testUtils.getExpectedJson('9999999', 'fileLocation', 'get-azure'),
|
|
118
|
+
'returned JSON was not equal expected'
|
|
119
|
+
);
|
|
120
|
+
assert.equal(
|
|
121
|
+
testUtils.getAPIHistoryLength(),
|
|
122
|
+
2,
|
|
123
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
124
|
+
);
|
|
125
|
+
return;
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
describe('Deploy ================', () => {
|
|
130
|
+
beforeEach(() => {
|
|
131
|
+
testUtils.mockSetup(true);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('Should update fileLocations', async () => {
|
|
135
|
+
// WHEN
|
|
136
|
+
const deployed = await handler.deploy(
|
|
137
|
+
'testInstance/testBU',
|
|
138
|
+
['fileLocation'],
|
|
139
|
+
['testExisting_fileLocation_exsftp', 'testExisting_fileLocation_aws']
|
|
140
|
+
);
|
|
141
|
+
// THEN
|
|
142
|
+
assert.equal(process.exitCode, 0, 'deploy should not have thrown an error');
|
|
143
|
+
// get results from cache
|
|
144
|
+
const result = cache.getCache();
|
|
145
|
+
assert.equal(
|
|
146
|
+
result.fileLocation ? Object.keys(result.fileLocation).length : 0,
|
|
147
|
+
6,
|
|
148
|
+
'unexpected number of fileLocations in cache'
|
|
149
|
+
);
|
|
150
|
+
assert.equal(
|
|
151
|
+
deployed?.['testInstance/testBU']?.fileLocation
|
|
152
|
+
? Object.keys(deployed['testInstance/testBU'].fileLocation).length
|
|
153
|
+
: 0,
|
|
154
|
+
2,
|
|
155
|
+
'unexpected number of fileLocations deployed'
|
|
156
|
+
);
|
|
157
|
+
// confirm created item
|
|
158
|
+
// TODO
|
|
159
|
+
|
|
160
|
+
// confirm updated item
|
|
161
|
+
assert.deepEqual(
|
|
162
|
+
await testUtils.getActualJson('testExisting_fileLocation_exsftp', 'fileLocation'),
|
|
163
|
+
await testUtils.getExpectedJson('9999999', 'fileLocation', 'patch-exsftp'),
|
|
164
|
+
'returned JSON was not equal expected for insert fileLocation'
|
|
165
|
+
);
|
|
166
|
+
// confirm updated item
|
|
167
|
+
assert.deepEqual(
|
|
168
|
+
await testUtils.getActualJson('testExisting_fileLocation_aws', 'fileLocation'),
|
|
169
|
+
await testUtils.getExpectedJson('9999999', 'fileLocation', 'patch-aws'),
|
|
170
|
+
'returned JSON was not equal expected for update fileLocation'
|
|
171
|
+
);
|
|
172
|
+
// check number of API calls
|
|
173
|
+
assert.equal(
|
|
174
|
+
testUtils.getAPIHistoryLength(),
|
|
175
|
+
4,
|
|
176
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
177
|
+
);
|
|
178
|
+
return;
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it('Should not update fileLocations', async () => {
|
|
182
|
+
// WHEN
|
|
183
|
+
const deployed = await handler.deploy(
|
|
184
|
+
'testInstance/testBU',
|
|
185
|
+
['fileLocation'],
|
|
186
|
+
['ExactTarget Enhanced FTP']
|
|
187
|
+
);
|
|
188
|
+
// THEN
|
|
189
|
+
assert.equal(process.exitCode, 1, 'deploy should have thrown an error');
|
|
190
|
+
// get results from cache
|
|
191
|
+
const result = cache.getCache();
|
|
192
|
+
assert.equal(
|
|
193
|
+
result.fileLocation ? Object.keys(result.fileLocation).length : 0,
|
|
194
|
+
6,
|
|
195
|
+
'unexpected number of fileLocations in cache'
|
|
196
|
+
);
|
|
197
|
+
assert.equal(
|
|
198
|
+
deployed?.['testInstance/testBU']?.fileLocation
|
|
199
|
+
? Object.keys(deployed['testInstance/testBU'].fileLocation).length
|
|
200
|
+
: 0,
|
|
201
|
+
0,
|
|
202
|
+
'unexpected number of fileLocations deployed'
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
// check number of API calls
|
|
206
|
+
assert.equal(
|
|
207
|
+
testUtils.getAPIHistoryLength(),
|
|
208
|
+
2,
|
|
209
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
210
|
+
);
|
|
211
|
+
return;
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
describe('Templating ================', () => {
|
|
216
|
+
it('Should create a fileLocation template via buildTemplate and build it', async () => {
|
|
217
|
+
// download first before we test buildTemplate
|
|
218
|
+
await handler.retrieve('testInstance/testBU', ['fileLocation']);
|
|
219
|
+
// buildTemplate
|
|
220
|
+
const result = await handler.buildTemplate(
|
|
221
|
+
'testInstance/testBU',
|
|
222
|
+
'fileLocation',
|
|
223
|
+
['testExisting_fileLocation_azure'],
|
|
224
|
+
['testSourceMarket']
|
|
225
|
+
);
|
|
226
|
+
assert.equal(process.exitCode, 0, 'buildTemplate should not have thrown an error');
|
|
227
|
+
assert.equal(
|
|
228
|
+
result.fileLocation ? Object.keys(result.fileLocation).length : 0,
|
|
229
|
+
1,
|
|
230
|
+
'only one fileLocation expected'
|
|
231
|
+
);
|
|
232
|
+
assert.deepEqual(
|
|
233
|
+
await testUtils.getActualTemplateJson(
|
|
234
|
+
'testExisting_fileLocation_azure',
|
|
235
|
+
'fileLocation'
|
|
236
|
+
),
|
|
237
|
+
await testUtils.getExpectedJson('9999999', 'fileLocation', 'template'),
|
|
238
|
+
'returned template JSON was not equal expected'
|
|
239
|
+
);
|
|
240
|
+
// buildDefinition
|
|
241
|
+
await handler.buildDefinition(
|
|
242
|
+
'testInstance/testBU',
|
|
243
|
+
'fileLocation',
|
|
244
|
+
['testExisting_fileLocation_azure'],
|
|
245
|
+
['testTargetMarket']
|
|
246
|
+
);
|
|
247
|
+
assert.equal(process.exitCode, 0, 'buildDefinition should not have thrown an error');
|
|
248
|
+
assert.deepEqual(
|
|
249
|
+
await testUtils.getActualDeployJson(
|
|
250
|
+
'testTemplated_fileLocation_azure',
|
|
251
|
+
'fileLocation'
|
|
252
|
+
),
|
|
253
|
+
await testUtils.getExpectedJson('9999999', 'fileLocation', 'build'),
|
|
254
|
+
'returned deployment JSON was not equal expected'
|
|
255
|
+
);
|
|
256
|
+
assert.equal(
|
|
257
|
+
testUtils.getAPIHistoryLength(),
|
|
258
|
+
2,
|
|
259
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
260
|
+
);
|
|
261
|
+
return;
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
describe('Delete ================', () => {
|
|
266
|
+
it('Should delete the item', async () => {
|
|
267
|
+
// WHEN
|
|
268
|
+
const isDeleted = await handler.deleteByKey(
|
|
269
|
+
'testInstance/testBU',
|
|
270
|
+
'fileLocation',
|
|
271
|
+
'testExisting_fileLocation_azure'
|
|
272
|
+
);
|
|
273
|
+
// THEN
|
|
274
|
+
assert.equal(process.exitCode, 0, 'deleteByKey should not have thrown an error');
|
|
275
|
+
assert.equal(isDeleted, true, 'deleteByKey should have returned true');
|
|
276
|
+
return;
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
});
|
|
@@ -36,7 +36,7 @@ describe('type: fileTransfer', () => {
|
|
|
36
36
|
);
|
|
37
37
|
assert.equal(
|
|
38
38
|
testUtils.getAPIHistoryLength(),
|
|
39
|
-
|
|
39
|
+
4,
|
|
40
40
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
41
41
|
);
|
|
42
42
|
return;
|
|
@@ -75,7 +75,7 @@ describe('type: fileTransfer', () => {
|
|
|
75
75
|
// check number of API calls
|
|
76
76
|
assert.equal(
|
|
77
77
|
testUtils.getAPIHistoryLength(),
|
|
78
|
-
|
|
78
|
+
6,
|
|
79
79
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
80
80
|
);
|
|
81
81
|
return;
|
|
@@ -117,7 +117,7 @@ describe('type: fileTransfer', () => {
|
|
|
117
117
|
);
|
|
118
118
|
assert.equal(
|
|
119
119
|
testUtils.getAPIHistoryLength(),
|
|
120
|
-
|
|
120
|
+
4,
|
|
121
121
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
122
122
|
);
|
|
123
123
|
return;
|
|
@@ -159,7 +159,7 @@ describe('type: fileTransfer', () => {
|
|
|
159
159
|
);
|
|
160
160
|
assert.equal(
|
|
161
161
|
testUtils.getAPIHistoryLength(),
|
|
162
|
-
|
|
162
|
+
4,
|
|
163
163
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
164
164
|
);
|
|
165
165
|
return;
|
package/test/type.filter.test.js
CHANGED
|
@@ -77,7 +77,7 @@ describe('type: filter', () => {
|
|
|
77
77
|
it('Should create & upsert a filter', async () => {
|
|
78
78
|
// WHEN
|
|
79
79
|
|
|
80
|
-
await handler.deploy('testInstance/testBU', ['filter']);
|
|
80
|
+
const deployed = await handler.deploy('testInstance/testBU', ['filter']);
|
|
81
81
|
// THEN
|
|
82
82
|
assert.equal(process.exitCode, 0, 'deploy should not have thrown an error');
|
|
83
83
|
// get results from cache
|
|
@@ -85,7 +85,14 @@ describe('type: filter', () => {
|
|
|
85
85
|
assert.equal(
|
|
86
86
|
result.filter ? Object.keys(result.filter).length : 0,
|
|
87
87
|
2,
|
|
88
|
-
'
|
|
88
|
+
'unexpected number of filters in cache'
|
|
89
|
+
);
|
|
90
|
+
assert.equal(
|
|
91
|
+
deployed?.['testInstance/testBU']?.filter
|
|
92
|
+
? Object.keys(deployed['testInstance/testBU'].filter).length
|
|
93
|
+
: 0,
|
|
94
|
+
2,
|
|
95
|
+
'unexpected number of filters deployed'
|
|
89
96
|
);
|
|
90
97
|
// confirm created item
|
|
91
98
|
assert.deepEqual(
|
|
@@ -46,7 +46,7 @@ describe('type: importFile', () => {
|
|
|
46
46
|
);
|
|
47
47
|
assert.equal(
|
|
48
48
|
testUtils.getAPIHistoryLength(),
|
|
49
|
-
|
|
49
|
+
16,
|
|
50
50
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
51
51
|
);
|
|
52
52
|
return;
|
|
@@ -75,7 +75,7 @@ describe('type: importFile', () => {
|
|
|
75
75
|
);
|
|
76
76
|
assert.equal(
|
|
77
77
|
testUtils.getAPIHistoryLength(),
|
|
78
|
-
|
|
78
|
+
14,
|
|
79
79
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
80
80
|
);
|
|
81
81
|
return;
|
|
@@ -115,7 +115,7 @@ describe('type: importFile', () => {
|
|
|
115
115
|
// check number of API calls
|
|
116
116
|
assert.equal(
|
|
117
117
|
testUtils.getAPIHistoryLength(),
|
|
118
|
-
|
|
118
|
+
18,
|
|
119
119
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
120
120
|
);
|
|
121
121
|
return;
|
|
@@ -157,7 +157,7 @@ describe('type: importFile', () => {
|
|
|
157
157
|
);
|
|
158
158
|
assert.equal(
|
|
159
159
|
testUtils.getAPIHistoryLength(),
|
|
160
|
-
|
|
160
|
+
14,
|
|
161
161
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
162
162
|
);
|
|
163
163
|
return;
|
|
@@ -199,7 +199,7 @@ describe('type: importFile', () => {
|
|
|
199
199
|
);
|
|
200
200
|
assert.equal(
|
|
201
201
|
testUtils.getAPIHistoryLength(),
|
|
202
|
-
|
|
202
|
+
16,
|
|
203
203
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
204
204
|
);
|
|
205
205
|
return;
|
|
@@ -52,6 +52,32 @@ describe('type: journey', () => {
|
|
|
52
52
|
return;
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
+
it('Should retrieve only published journeys', async () => {
|
|
56
|
+
handler.setOptions({ onlyPublished: true });
|
|
57
|
+
// WHEN
|
|
58
|
+
await handler.retrieve('testInstance/testBU', ['journey']);
|
|
59
|
+
// THEN
|
|
60
|
+
assert.equal(process.exitCode, 0, 'retrieve should not have thrown an error');
|
|
61
|
+
// get results from cache
|
|
62
|
+
const result = cache.getCache();
|
|
63
|
+
assert.equal(
|
|
64
|
+
result.journey ? Object.keys(result.journey).length : 0,
|
|
65
|
+
1,
|
|
66
|
+
'unexpected number of journeys'
|
|
67
|
+
);
|
|
68
|
+
assert.deepEqual(
|
|
69
|
+
await testUtils.getActualJson('testExisting_temail', 'journey'),
|
|
70
|
+
await testUtils.getExpectedJson('9999999', 'journey', 'get-transactionalEmail'),
|
|
71
|
+
'returned JSON was not equal expected'
|
|
72
|
+
);
|
|
73
|
+
assert.equal(
|
|
74
|
+
testUtils.getAPIHistoryLength(),
|
|
75
|
+
24,
|
|
76
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
77
|
+
);
|
|
78
|
+
return;
|
|
79
|
+
});
|
|
80
|
+
|
|
55
81
|
it('Should retrieve a Quicksend journey with key', async () => {
|
|
56
82
|
// WHEN
|
|
57
83
|
await handler.retrieve(
|
package/test/type.query.test.js
CHANGED
|
@@ -648,7 +648,7 @@ describe('type: query', () => {
|
|
|
648
648
|
// check number of API calls
|
|
649
649
|
assert.equal(
|
|
650
650
|
testUtils.getAPIHistoryLength(),
|
|
651
|
-
|
|
651
|
+
48,
|
|
652
652
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
653
653
|
);
|
|
654
654
|
return;
|
|
@@ -690,7 +690,7 @@ describe('type: query', () => {
|
|
|
690
690
|
// check number of API calls
|
|
691
691
|
assert.equal(
|
|
692
692
|
testUtils.getAPIHistoryLength(),
|
|
693
|
-
|
|
693
|
+
50,
|
|
694
694
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
695
695
|
);
|
|
696
696
|
return;
|
package/test/type.script.test.js
CHANGED
package/tsconfig.json
CHANGED
package/tsconfig.npmScripts.json
CHANGED