mcdev 5.0.1 → 5.1.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/.coverage-comment-template.svelte +177 -161
- package/.eslintrc.json +1 -0
- package/.github/ISSUE_TEMPLATE/bug.yml +2 -0
- package/.github/dependabot.yml +8 -0
- package/.github/workflows/coverage-base-update.yml +6 -2
- package/.github/workflows/coverage-develop-branch.yml +7 -6
- package/.github/workflows/coverage-main-branch.yml +7 -6
- package/.github/workflows/coverage.yml +7 -2
- package/.husky/commit-msg +1 -1
- package/.husky/post-checkout +35 -3
- package/.husky/post-merge +21 -0
- package/.husky/pre-commit +1 -0
- package/docs/dist/documentation.md +222 -62
- package/lib/Deployer.js +3 -4
- package/lib/cli.js +36 -8
- package/lib/index.js +175 -3
- package/lib/metadataTypes/Asset.js +4 -2
- package/lib/metadataTypes/Automation.js +413 -195
- package/lib/metadataTypes/DataExtension.js +6 -8
- package/lib/metadataTypes/DataExtensionField.js +5 -5
- package/lib/metadataTypes/Journey.js +11 -10
- package/lib/metadataTypes/MetadataType.js +76 -22
- package/lib/metadataTypes/MobileKeyword.js +165 -20
- package/lib/metadataTypes/MobileMessage.js +20 -28
- package/lib/metadataTypes/Query.js +26 -0
- package/lib/metadataTypes/Role.js +2 -3
- package/lib/metadataTypes/TransactionalSMS.js +5 -5
- package/lib/metadataTypes/User.js +3 -17
- package/lib/metadataTypes/definitions/Asset.definition.js +1 -0
- package/lib/metadataTypes/definitions/Automation.definition.js +52 -6
- package/lib/metadataTypes/definitions/DataExtension.definition.js +1 -0
- package/lib/metadataTypes/definitions/DataExtract.definition.js +1 -0
- package/lib/metadataTypes/definitions/EmailSend.definition.js +1 -0
- package/lib/metadataTypes/definitions/Event.definition.js +1 -0
- package/lib/metadataTypes/definitions/Filter.definition.js +1 -0
- package/lib/metadataTypes/definitions/ImportFile.definition.js +1 -0
- package/lib/metadataTypes/definitions/MobileKeyword.definition.js +20 -7
- package/lib/metadataTypes/definitions/MobileMessage.definition.js +50 -8
- package/lib/metadataTypes/definitions/Query.definition.js +1 -0
- package/lib/metadataTypes/definitions/Role.definition.js +1 -0
- package/lib/metadataTypes/definitions/TriggeredSend.definition.js +1 -0
- package/lib/metadataTypes/definitions/User.definition.js +2 -0
- package/lib/util/auth.js +4 -1
- package/lib/util/cli.js +1 -1
- package/lib/util/devops.js +13 -11
- package/lib/util/file.js +5 -3
- package/lib/util/util.js +153 -129
- package/package.json +11 -11
- package/test/general.test.js +26 -0
- package/test/mockRoot/.mcdevrc.json +3 -1
- package/test/mockRoot/deploy/testInstance/testBU/automation/testExisting_automation.automation-meta.json +53 -0
- package/test/mockRoot/deploy/testInstance/testBU/automation/testNew_automation.automation-meta.json +46 -0
- package/test/mockRoot/deploy/testInstance/testBU/mobileKeyword/{testNew_keyword.mobileKeyword-meta.json → 4912312345678.TESTNEW_KEYWORD.mobileKeyword-meta.json} +1 -4
- package/test/mockRoot/deploy/testInstance/testBU/mobileKeyword/{testNew_keyword_blocked.mobileKeyword-meta.json → 4912312345678.TESTNEW_KEYWORD_BLOCKED.mobileKeyword-meta.json} +1 -4
- package/test/mockRoot/deploy/testInstance/testBU/query/{testExistingQuery.query-meta.json → testExisting_query.query-meta.json} +2 -2
- package/test/mockRoot/deploy/testInstance/testBU/query/{testNewQuery.query-meta.json → testNew_query.query-meta.json} +2 -2
- package/test/mockRoot/deploy/testInstance/testBU/transactionalSMS/testExisting_tsms.transactionalSMS-meta.json +1 -1
- package/test/mockRoot/deploy/testInstance/testBU/transactionalSMS/testNew_tsms.transactionalSMS-meta.json +1 -1
- package/test/resourceFactory.js +64 -21
- package/test/resources/1111111/user/retrieve-expected.md +19 -0
- package/test/resources/9999999/automation/build-expected.json +58 -0
- package/test/resources/9999999/automation/create-expected.json +46 -0
- package/test/resources/9999999/automation/create-testNew_automation-expected.md +28 -0
- package/test/resources/9999999/automation/delete-response.xml +40 -0
- package/test/resources/9999999/automation/retrieve-expected.json +58 -0
- package/test/resources/9999999/automation/retrieve-testExisting_automation-expected.md +30 -0
- package/test/resources/9999999/automation/template-expected.json +58 -0
- package/test/resources/9999999/automation/update-expected.json +46 -0
- package/test/resources/9999999/automation/update-testExisting_automation-expected.md +28 -0
- package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-1f7f8788c560/get-response.json +85 -0
- package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-1f7f8788c560/patch-response.json +85 -0
- package/test/resources/9999999/automation/v1/automations/a8afb0e2-b00a-4c88-ad2e-1f7f8788c560/get-response.json +85 -0
- package/test/resources/9999999/automation/v1/automations/post-response.json +85 -0
- package/test/resources/9999999/automation/v1/dataextracts/56c5370a-f988-4f36-b0ee-0f876573f6d7/get-response.json +38 -0
- package/test/resources/9999999/automation/v1/dataextracts/get-response.json +20 -0
- package/test/resources/9999999/automation/v1/filetransfers/72c328ac-f5b0-4e37-91d3-a775666f15a6/get-response.json +18 -0
- package/test/resources/9999999/automation/v1/filetransfers/get-response.json +15 -0
- package/test/resources/9999999/automation/v1/imports/get-response.json +38 -0
- package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/actions/start/post-response.txt +1 -0
- package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/get-response.json +2 -2
- package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/patch-response.json +2 -2
- package/test/resources/9999999/automation/v1/queries/get-response.json +4 -4
- package/test/resources/9999999/automation/v1/queries/post-response.json +2 -2
- package/test/resources/9999999/automation/v1/scripts/get-response.json +17 -0
- package/test/resources/9999999/dataExtension/retrieve-expected.md +18 -0
- package/test/resources/9999999/dataFolder/retrieve-ContentType=automations-response.xml +48 -0
- package/test/resources/9999999/dataFolder/retrieve-ContentType=queryactivity-response.xml +48 -0
- package/test/resources/9999999/dataFolder/retrieve-response.xml +22 -0
- package/test/resources/9999999/emailSendDefinition/retrieve-response.xml +85 -0
- package/test/resources/9999999/journey/build-expected.json +1 -1
- package/test/resources/9999999/journey/get-expected.json +1 -1
- package/test/resources/9999999/journey/put-expected.json +1 -1
- package/test/resources/9999999/journey/template-expected.json +1 -1
- package/test/resources/9999999/legacy/v1/beta/automations/notifications/RkpOcE9qSVh2VUdnYTVJbWFfWW14dzoyNTow/get-response.json +21 -0
- package/test/resources/9999999/legacy/v1/beta/automations/notifications/RkpOcE9qSVh2VUdnYTVJbWFfWW14dzoyNTow/post-response.json +0 -0
- package/test/resources/9999999/legacy/v1/beta/bulk/automations/automation/definition/get-response.json +30 -0
- package/test/resources/9999999/legacy/v1/beta/mobile/keyword/NXV4ZFMwTEFwRVczd3RaLUF5X3p5dzo4Njow/get-response.json +1 -1
- package/test/resources/9999999/legacy/v1/beta/mobile/keyword/get-response.json +1 -1
- package/test/resources/9999999/legacy/v1/beta/mobile/message/NTIzOjc4OjA/get-response.json +1 -1
- package/test/resources/9999999/legacy/v1/beta/mobile/message/get-response.json +1 -1
- package/test/resources/9999999/messaging/v1/sms/definitions/post-response.json +1 -1
- package/test/resources/9999999/messaging/v1/sms/definitions/testExisting_tsms/get-response.json +1 -1
- package/test/resources/9999999/messaging/v1/sms/definitions/testExisting_tsms/patch-response.json +1 -1
- package/test/resources/9999999/mobileKeyword/build-expected.json +1 -4
- package/test/resources/9999999/mobileKeyword/get-expected.json +1 -4
- package/test/resources/9999999/mobileKeyword/post-create-expected.json +1 -4
- package/test/resources/9999999/mobileKeyword/template-expected.json +1 -4
- package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation-response.xml +30 -0
- package/test/resources/9999999/program/retrieve-CustomerKey=testNew_automation-response.xml +30 -0
- package/test/resources/9999999/program/retrieve-Name=testExisting_automation-response.xml +31 -0
- package/test/resources/9999999/program/retrieve-response.xml +32 -0
- package/test/resources/9999999/query/build-expected.json +2 -2
- package/test/resources/9999999/query/build-expected.sql +1 -1
- package/test/resources/9999999/query/get-expected.json +2 -2
- package/test/resources/9999999/query/get-expected.sql +1 -1
- package/test/resources/9999999/query/get2-expected.json +2 -2
- package/test/resources/9999999/query/patch-expected.json +2 -2
- package/test/resources/9999999/query/patch-expected.sql +1 -1
- package/test/resources/9999999/query/post-expected.json +2 -2
- package/test/resources/9999999/query/post-expected.sql +1 -1
- package/test/resources/9999999/query/template-expected.json +2 -2
- package/test/resources/9999999/query/template-expected.sql +1 -1
- package/test/resources/9999999/transactionalSMS/build-expected.json +1 -1
- package/test/resources/9999999/transactionalSMS/get-expected.json +1 -1
- package/test/resources/9999999/transactionalSMS/patch-expected.json +1 -1
- package/test/resources/9999999/transactionalSMS/post-expected.json +1 -1
- package/test/resources/9999999/transactionalSMS/template-expected.json +1 -1
- package/test/type.automation.test.js +259 -0
- package/test/type.dataExtension.test.js +16 -1
- package/test/type.mobileKeyword.test.js +57 -19
- package/test/type.query.test.js +39 -26
- package/test/type.user.test.js +44 -1
- package/test/utils.js +16 -5
- package/.coverage-comment-template.md +0 -20
- /package/test/mockRoot/deploy/testInstance/testBU/mobileKeyword/{testNew_keyword.mobileKeyword-meta.amp → 4912312345678.TESTNEW_KEYWORD.mobileKeyword-meta.amp} +0 -0
- /package/test/mockRoot/deploy/testInstance/testBU/mobileKeyword/{testNew_keyword_blocked.mobileKeyword-meta.amp → 4912312345678.TESTNEW_KEYWORD_BLOCKED.mobileKeyword-meta.amp} +0 -0
- /package/test/mockRoot/deploy/testInstance/testBU/query/{testExistingQuery.query-meta.sql → testExisting_query.query-meta.sql} +0 -0
- /package/test/mockRoot/deploy/testInstance/testBU/query/{testNewQuery.query-meta.sql → testNew_query.query-meta.sql} +0 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
const chai = require('chai');
|
|
2
|
+
const chaiFiles = require('chai-files');
|
|
3
|
+
|
|
4
|
+
chai.use(chaiFiles);
|
|
5
|
+
|
|
6
|
+
const assert = chai.assert;
|
|
7
|
+
const expect = chai.expect;
|
|
8
|
+
const file = chaiFiles.file;
|
|
9
|
+
const cache = require('../lib/util/cache');
|
|
10
|
+
const testUtils = require('./utils');
|
|
11
|
+
const handler = require('../lib/index');
|
|
12
|
+
|
|
13
|
+
describe('type: automation', () => {
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
testUtils.mockSetup();
|
|
16
|
+
});
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
testUtils.mockReset();
|
|
19
|
+
});
|
|
20
|
+
describe('Retrieve ================', () => {
|
|
21
|
+
it('Should retrieve a automation', async () => {
|
|
22
|
+
// WHEN
|
|
23
|
+
await handler.retrieve('testInstance/testBU', ['automation']);
|
|
24
|
+
// THEN
|
|
25
|
+
assert.equal(process.exitCode, false, 'retrieve should not have thrown an error');
|
|
26
|
+
// get results from cache
|
|
27
|
+
const result = cache.getCache();
|
|
28
|
+
assert.equal(
|
|
29
|
+
result.automation ? Object.keys(result.automation).length : 0,
|
|
30
|
+
1,
|
|
31
|
+
'only one automation expected'
|
|
32
|
+
);
|
|
33
|
+
assert.deepEqual(
|
|
34
|
+
await testUtils.getActualJson('testExisting_automation', 'automation'),
|
|
35
|
+
await testUtils.getExpectedJson('9999999', 'automation', 'retrieve'),
|
|
36
|
+
|
|
37
|
+
'returned metadata was not equal expected'
|
|
38
|
+
);
|
|
39
|
+
// check if MD file was created and equals expectations
|
|
40
|
+
expect(file(testUtils.getActualDoc('testExisting_automation', 'automation'))).to.equal(
|
|
41
|
+
file(
|
|
42
|
+
testUtils.getExpectedFile(
|
|
43
|
+
'9999999',
|
|
44
|
+
'automation',
|
|
45
|
+
'retrieve-testExisting_automation',
|
|
46
|
+
'md'
|
|
47
|
+
)
|
|
48
|
+
)
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
assert.equal(
|
|
52
|
+
testUtils.getAPIHistoryLength(),
|
|
53
|
+
14,
|
|
54
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
55
|
+
);
|
|
56
|
+
return;
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
describe('Deploy ================', () => {
|
|
60
|
+
beforeEach(() => {
|
|
61
|
+
testUtils.mockSetup(true);
|
|
62
|
+
});
|
|
63
|
+
it('Should create & update a automation', async () => {
|
|
64
|
+
// WHEN
|
|
65
|
+
await handler.deploy('testInstance/testBU', ['automation']);
|
|
66
|
+
// THEN
|
|
67
|
+
assert.equal(process.exitCode, false, 'deploy should not have thrown an error');
|
|
68
|
+
|
|
69
|
+
// get results from cache
|
|
70
|
+
const result = cache.getCache();
|
|
71
|
+
assert.equal(
|
|
72
|
+
result.automation ? Object.keys(result.automation).length : 0,
|
|
73
|
+
2,
|
|
74
|
+
'two automations expected'
|
|
75
|
+
);
|
|
76
|
+
// insert
|
|
77
|
+
assert.deepEqual(
|
|
78
|
+
await testUtils.getActualJson('testNew_automation', 'automation'),
|
|
79
|
+
await testUtils.getExpectedJson('9999999', 'automation', 'create'),
|
|
80
|
+
'returned metadata was not equal expected for create'
|
|
81
|
+
);
|
|
82
|
+
// update
|
|
83
|
+
assert.deepEqual(
|
|
84
|
+
await testUtils.getActualJson('testExisting_automation', 'automation'),
|
|
85
|
+
await testUtils.getExpectedJson('9999999', 'automation', 'update'),
|
|
86
|
+
'returned metadata was not equal expected for update'
|
|
87
|
+
);
|
|
88
|
+
// check if MD file was created and equals expectations
|
|
89
|
+
expect(file(testUtils.getActualDoc('testExisting_automation', 'automation'))).to.equal(
|
|
90
|
+
file(
|
|
91
|
+
testUtils.getExpectedFile(
|
|
92
|
+
'9999999',
|
|
93
|
+
'automation',
|
|
94
|
+
'update-testExisting_automation',
|
|
95
|
+
'md'
|
|
96
|
+
)
|
|
97
|
+
)
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
// check if MD file was created and equals expectations
|
|
101
|
+
expect(file(testUtils.getActualDoc('testNew_automation', 'automation'))).to.equal(
|
|
102
|
+
file(
|
|
103
|
+
testUtils.getExpectedFile(
|
|
104
|
+
'9999999',
|
|
105
|
+
'automation',
|
|
106
|
+
'create-testNew_automation',
|
|
107
|
+
'md'
|
|
108
|
+
)
|
|
109
|
+
)
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
assert.equal(
|
|
113
|
+
testUtils.getAPIHistoryLength(),
|
|
114
|
+
15,
|
|
115
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
116
|
+
);
|
|
117
|
+
return;
|
|
118
|
+
});
|
|
119
|
+
it('Should change the key during update via --changeKeyValue');
|
|
120
|
+
});
|
|
121
|
+
describe('Templating ================', () => {
|
|
122
|
+
it('Should create a automation template via retrieveAsTemplate and build it', async () => {
|
|
123
|
+
// GIVEN there is a template
|
|
124
|
+
const result = await handler.retrieveAsTemplate(
|
|
125
|
+
'testInstance/testBU',
|
|
126
|
+
'automation',
|
|
127
|
+
['testExisting_automation'],
|
|
128
|
+
'testSourceMarket'
|
|
129
|
+
);
|
|
130
|
+
assert.equal(
|
|
131
|
+
process.exitCode,
|
|
132
|
+
false,
|
|
133
|
+
'retrieveAsTemplate should not have thrown an error'
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
// WHEN
|
|
137
|
+
assert.equal(
|
|
138
|
+
result.automation ? Object.keys(result.automation).length : 0,
|
|
139
|
+
1,
|
|
140
|
+
'only one automation expected'
|
|
141
|
+
);
|
|
142
|
+
assert.deepEqual(
|
|
143
|
+
await testUtils.getActualTemplateJson('testExisting_automation', 'automation'),
|
|
144
|
+
await testUtils.getExpectedJson('9999999', 'automation', 'template'),
|
|
145
|
+
'returned template was not equal expected'
|
|
146
|
+
);
|
|
147
|
+
// THEN
|
|
148
|
+
await handler.buildDefinition(
|
|
149
|
+
'testInstance/testBU',
|
|
150
|
+
'automation',
|
|
151
|
+
'testExisting_automation',
|
|
152
|
+
'testTargetMarket'
|
|
153
|
+
);
|
|
154
|
+
assert.equal(
|
|
155
|
+
process.exitCode,
|
|
156
|
+
false,
|
|
157
|
+
'buildDefinition should not have thrown an error'
|
|
158
|
+
);
|
|
159
|
+
assert.deepEqual(
|
|
160
|
+
await testUtils.getActualDeployJson('testTemplated_automation', 'automation'),
|
|
161
|
+
await testUtils.getExpectedJson('9999999', 'automation', 'build'),
|
|
162
|
+
'returned deployment file was not equal expected'
|
|
163
|
+
);
|
|
164
|
+
assert.equal(
|
|
165
|
+
testUtils.getAPIHistoryLength(),
|
|
166
|
+
14,
|
|
167
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
168
|
+
);
|
|
169
|
+
return;
|
|
170
|
+
});
|
|
171
|
+
it('Should create a automation template via buildTemplate and build it', async () => {
|
|
172
|
+
// download first before we test buildTemplate
|
|
173
|
+
await handler.retrieve('testInstance/testBU', ['automation']);
|
|
174
|
+
// GIVEN there is a template
|
|
175
|
+
const result = await handler.buildTemplate(
|
|
176
|
+
'testInstance/testBU',
|
|
177
|
+
'automation',
|
|
178
|
+
['testExisting_automation'],
|
|
179
|
+
'testSourceMarket'
|
|
180
|
+
);
|
|
181
|
+
assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error');
|
|
182
|
+
// WHEN
|
|
183
|
+
assert.equal(
|
|
184
|
+
result.automation ? Object.keys(result.automation).length : 0,
|
|
185
|
+
1,
|
|
186
|
+
'only one automation expected'
|
|
187
|
+
);
|
|
188
|
+
assert.deepEqual(
|
|
189
|
+
await testUtils.getActualTemplateJson('testExisting_automation', 'automation'),
|
|
190
|
+
await testUtils.getExpectedJson('9999999', 'automation', 'template'),
|
|
191
|
+
'returned template was not equal expected'
|
|
192
|
+
);
|
|
193
|
+
// THEN
|
|
194
|
+
await handler.buildDefinition(
|
|
195
|
+
'testInstance/testBU',
|
|
196
|
+
'automation',
|
|
197
|
+
'testExisting_automation',
|
|
198
|
+
'testTargetMarket'
|
|
199
|
+
);
|
|
200
|
+
assert.equal(
|
|
201
|
+
process.exitCode,
|
|
202
|
+
false,
|
|
203
|
+
'buildDefinition should not have thrown an error'
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
assert.deepEqual(
|
|
207
|
+
await testUtils.getActualDeployJson('testTemplated_automation', 'automation'),
|
|
208
|
+
await testUtils.getExpectedJson('9999999', 'automation', 'build'),
|
|
209
|
+
'returned deployment file was not equal expected'
|
|
210
|
+
);
|
|
211
|
+
assert.equal(
|
|
212
|
+
testUtils.getAPIHistoryLength(),
|
|
213
|
+
14,
|
|
214
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
215
|
+
);
|
|
216
|
+
return;
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
describe('Delete ================', () => {
|
|
220
|
+
it('Should delete the item', async () => {
|
|
221
|
+
// WHEN
|
|
222
|
+
const result = await handler.deleteByKey('testInstance/testBU', 'automation', [
|
|
223
|
+
'testExisting_automation',
|
|
224
|
+
]);
|
|
225
|
+
// THEN
|
|
226
|
+
assert.equal(process.exitCode, false, 'delete should not have thrown an error');
|
|
227
|
+
|
|
228
|
+
assert.equal(result, true, 'should have deleted the item');
|
|
229
|
+
return;
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
describe('CI/CD ================', () => {
|
|
233
|
+
it('Should return a list of files based on their type and key', async () => {
|
|
234
|
+
// WHEN
|
|
235
|
+
const fileList = await handler.getFilesToCommit('testInstance/testBU', 'automation', [
|
|
236
|
+
'testExisting_automation',
|
|
237
|
+
]);
|
|
238
|
+
// THEN
|
|
239
|
+
assert.equal(
|
|
240
|
+
process.exitCode,
|
|
241
|
+
false,
|
|
242
|
+
'getFilesToCommit should not have thrown an error'
|
|
243
|
+
);
|
|
244
|
+
assert.equal(fileList.length, 2, 'expected only 2 file paths');
|
|
245
|
+
|
|
246
|
+
assert.equal(
|
|
247
|
+
fileList[0].split('\\').join('/'),
|
|
248
|
+
'retrieve/testInstance/testBU/automation/testExisting_automation.automation-meta.json',
|
|
249
|
+
'wrong JSON path'
|
|
250
|
+
);
|
|
251
|
+
assert.equal(
|
|
252
|
+
fileList[1].split('\\').join('/'),
|
|
253
|
+
'retrieve/testInstance/testBU/automation/testExisting_automation.automation-doc.md',
|
|
254
|
+
'wrong MD path'
|
|
255
|
+
);
|
|
256
|
+
return;
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
});
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const chai = require('chai');
|
|
2
|
+
const chaiFiles = require('chai-files');
|
|
3
|
+
|
|
4
|
+
chai.use(chaiFiles);
|
|
5
|
+
|
|
6
|
+
const assert = chai.assert;
|
|
7
|
+
const expect = chai.expect;
|
|
8
|
+
const file = chaiFiles.file;
|
|
2
9
|
const cache = require('../lib/util/cache');
|
|
3
10
|
const testUtils = require('./utils');
|
|
4
11
|
const handler = require('../lib/index');
|
|
@@ -29,6 +36,13 @@ describe('type: dataExtension', () => {
|
|
|
29
36
|
|
|
30
37
|
'returned metadata was not equal expected'
|
|
31
38
|
);
|
|
39
|
+
// check if MD file was created and equals expectations
|
|
40
|
+
expect(
|
|
41
|
+
file(testUtils.getActualDoc('testExisting_dataExtension', 'dataExtension'))
|
|
42
|
+
).to.equal(
|
|
43
|
+
file(testUtils.getExpectedFile('9999999', 'dataExtension', 'retrieve', 'md'))
|
|
44
|
+
);
|
|
45
|
+
|
|
32
46
|
assert.equal(
|
|
33
47
|
testUtils.getAPIHistoryLength(),
|
|
34
48
|
5,
|
|
@@ -74,6 +88,7 @@ describe('type: dataExtension', () => {
|
|
|
74
88
|
return;
|
|
75
89
|
});
|
|
76
90
|
it('Should change the key during update via --changeKeyValue');
|
|
91
|
+
it('Should rename fields');
|
|
77
92
|
});
|
|
78
93
|
describe('Templating ================', () => {
|
|
79
94
|
it('Should create a dataExtension template via retrieveAsTemplate and build it', async () => {
|
|
@@ -30,12 +30,21 @@ describe('type: mobileKeyword', () => {
|
|
|
30
30
|
'only 1 mobileKeywords expected'
|
|
31
31
|
);
|
|
32
32
|
assert.deepEqual(
|
|
33
|
-
await testUtils.getActualJson(
|
|
33
|
+
await testUtils.getActualJson(
|
|
34
|
+
'4912312345678.TESTEXISTING_KEYWORD',
|
|
35
|
+
'mobileKeyword'
|
|
36
|
+
),
|
|
34
37
|
await testUtils.getExpectedJson('9999999', 'mobileKeyword', 'get'),
|
|
35
38
|
'saved JSON was not equal expected'
|
|
36
39
|
);
|
|
37
40
|
expect(
|
|
38
|
-
file(
|
|
41
|
+
file(
|
|
42
|
+
testUtils.getActualFile(
|
|
43
|
+
'4912312345678.TESTEXISTING_KEYWORD',
|
|
44
|
+
'mobileKeyword',
|
|
45
|
+
'amp'
|
|
46
|
+
)
|
|
47
|
+
)
|
|
39
48
|
).to.equal(file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'get', 'amp')));
|
|
40
49
|
assert.equal(
|
|
41
50
|
testUtils.getAPIHistoryLength(),
|
|
@@ -51,7 +60,11 @@ describe('type: mobileKeyword', () => {
|
|
|
51
60
|
});
|
|
52
61
|
it('Should create (but not update) a mobileKeyword', async () => {
|
|
53
62
|
// WHEN
|
|
54
|
-
await handler.deploy(
|
|
63
|
+
await handler.deploy(
|
|
64
|
+
'testInstance/testBU',
|
|
65
|
+
['mobileKeyword'],
|
|
66
|
+
['4912312345678.TESTNEW_KEYWORD']
|
|
67
|
+
);
|
|
55
68
|
// THEN
|
|
56
69
|
assert.equal(process.exitCode, false, 'deploy should not have thrown an error');
|
|
57
70
|
// get results from cache
|
|
@@ -63,12 +76,14 @@ describe('type: mobileKeyword', () => {
|
|
|
63
76
|
);
|
|
64
77
|
// confirm created item
|
|
65
78
|
assert.deepEqual(
|
|
66
|
-
await testUtils.getActualJson('
|
|
79
|
+
await testUtils.getActualJson('4912312345678.TESTNEW_KEYWORD', 'mobileKeyword'),
|
|
67
80
|
await testUtils.getExpectedJson('9999999', 'mobileKeyword', 'post-create'),
|
|
68
81
|
'returned JSON was not equal expected for insert mobileKeyword'
|
|
69
82
|
);
|
|
70
83
|
expect(
|
|
71
|
-
file(
|
|
84
|
+
file(
|
|
85
|
+
testUtils.getActualFile('4912312345678.TESTNEW_KEYWORD', 'mobileKeyword', 'amp')
|
|
86
|
+
)
|
|
72
87
|
).to.equal(
|
|
73
88
|
file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'post-create', 'amp'))
|
|
74
89
|
);
|
|
@@ -92,7 +107,7 @@ describe('type: mobileKeyword', () => {
|
|
|
92
107
|
await handler.deploy(
|
|
93
108
|
'testInstance/testBU',
|
|
94
109
|
['mobileKeyword'],
|
|
95
|
-
['
|
|
110
|
+
['4912312345678.TESTNEW_KEYWORD_BLOCKED']
|
|
96
111
|
);
|
|
97
112
|
// THEN
|
|
98
113
|
assert.equal(process.exitCode, true, 'deploy should have thrown an error');
|
|
@@ -113,7 +128,7 @@ describe('type: mobileKeyword', () => {
|
|
|
113
128
|
const result = await handler.retrieveAsTemplate(
|
|
114
129
|
'testInstance/testBU',
|
|
115
130
|
'mobileKeyword',
|
|
116
|
-
['
|
|
131
|
+
['4912312345678.TESTEXISTING_KEYWORD'],
|
|
117
132
|
'testSourceMarket'
|
|
118
133
|
);
|
|
119
134
|
// WHEN
|
|
@@ -128,13 +143,20 @@ describe('type: mobileKeyword', () => {
|
|
|
128
143
|
'only one item expected'
|
|
129
144
|
);
|
|
130
145
|
assert.deepEqual(
|
|
131
|
-
await testUtils.getActualTemplateJson(
|
|
146
|
+
await testUtils.getActualTemplateJson(
|
|
147
|
+
'4912312345678.TESTEXISTING_KEYWORD',
|
|
148
|
+
'mobileKeyword'
|
|
149
|
+
),
|
|
132
150
|
await testUtils.getExpectedJson('9999999', 'mobileKeyword', 'template'),
|
|
133
151
|
'returned template JSON was not equal expected'
|
|
134
152
|
);
|
|
135
153
|
expect(
|
|
136
154
|
file(
|
|
137
|
-
testUtils.getActualTemplateFile(
|
|
155
|
+
testUtils.getActualTemplateFile(
|
|
156
|
+
'4912312345678.TESTEXISTING_KEYWORD',
|
|
157
|
+
'mobileKeyword',
|
|
158
|
+
'amp'
|
|
159
|
+
)
|
|
138
160
|
)
|
|
139
161
|
).to.equal(
|
|
140
162
|
file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'template', 'amp'))
|
|
@@ -153,7 +175,7 @@ describe('type: mobileKeyword', () => {
|
|
|
153
175
|
const result = await handler.buildTemplate(
|
|
154
176
|
'testInstance/testBU',
|
|
155
177
|
'mobileKeyword',
|
|
156
|
-
['
|
|
178
|
+
['4912312345678.TESTEXISTING_KEYWORD'],
|
|
157
179
|
'testSourceMarket'
|
|
158
180
|
);
|
|
159
181
|
assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error');
|
|
@@ -164,13 +186,20 @@ describe('type: mobileKeyword', () => {
|
|
|
164
186
|
'only one mobileKeyword expected'
|
|
165
187
|
);
|
|
166
188
|
assert.deepEqual(
|
|
167
|
-
await testUtils.getActualTemplateJson(
|
|
189
|
+
await testUtils.getActualTemplateJson(
|
|
190
|
+
'4912312345678.TESTEXISTING_KEYWORD',
|
|
191
|
+
'mobileKeyword'
|
|
192
|
+
),
|
|
168
193
|
await testUtils.getExpectedJson('9999999', 'mobileKeyword', 'template'),
|
|
169
194
|
'returned template JSON was not equal expected'
|
|
170
195
|
);
|
|
171
196
|
expect(
|
|
172
197
|
file(
|
|
173
|
-
testUtils.getActualTemplateFile(
|
|
198
|
+
testUtils.getActualTemplateFile(
|
|
199
|
+
'4912312345678.TESTEXISTING_KEYWORD',
|
|
200
|
+
'mobileKeyword',
|
|
201
|
+
'amp'
|
|
202
|
+
)
|
|
174
203
|
)
|
|
175
204
|
).to.equal(
|
|
176
205
|
file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'template', 'amp'))
|
|
@@ -180,7 +209,7 @@ describe('type: mobileKeyword', () => {
|
|
|
180
209
|
await handler.buildDefinition(
|
|
181
210
|
'testInstance/testBU',
|
|
182
211
|
'mobileKeyword',
|
|
183
|
-
'
|
|
212
|
+
'4912312345678.TESTEXISTING_KEYWORD',
|
|
184
213
|
'testTargetMarket'
|
|
185
214
|
);
|
|
186
215
|
assert.equal(
|
|
@@ -189,12 +218,21 @@ describe('type: mobileKeyword', () => {
|
|
|
189
218
|
'buildDefinition should not have thrown an error'
|
|
190
219
|
);
|
|
191
220
|
assert.deepEqual(
|
|
192
|
-
await testUtils.getActualDeployJson(
|
|
221
|
+
await testUtils.getActualDeployJson(
|
|
222
|
+
'4912312345678.TESTTEMPLATED_KEYWORD',
|
|
223
|
+
'mobileKeyword'
|
|
224
|
+
),
|
|
193
225
|
await testUtils.getExpectedJson('9999999', 'mobileKeyword', 'build'),
|
|
194
226
|
'returned deployment JSON was not equal expected'
|
|
195
227
|
);
|
|
196
228
|
expect(
|
|
197
|
-
file(
|
|
229
|
+
file(
|
|
230
|
+
testUtils.getActualDeployFile(
|
|
231
|
+
'4912312345678.TESTTEMPLATED_KEYWORD',
|
|
232
|
+
'mobileKeyword',
|
|
233
|
+
'amp'
|
|
234
|
+
)
|
|
235
|
+
)
|
|
198
236
|
).to.equal(file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'build', 'amp')));
|
|
199
237
|
|
|
200
238
|
assert.equal(
|
|
@@ -209,7 +247,7 @@ describe('type: mobileKeyword', () => {
|
|
|
209
247
|
it('Should delete the item', async () => {
|
|
210
248
|
// WHEN
|
|
211
249
|
const result = await handler.deleteByKey('testInstance/testBU', 'mobileKeyword', [
|
|
212
|
-
'
|
|
250
|
+
'4912312345678.TESTEXISTING_KEYWORD',
|
|
213
251
|
]);
|
|
214
252
|
// THEN
|
|
215
253
|
assert.equal(process.exitCode, false, 'delete should not have thrown an error');
|
|
@@ -224,7 +262,7 @@ describe('type: mobileKeyword', () => {
|
|
|
224
262
|
const fileList = await handler.getFilesToCommit(
|
|
225
263
|
'testInstance/testBU',
|
|
226
264
|
'mobileKeyword',
|
|
227
|
-
['
|
|
265
|
+
['4912312345678.TESTEXISTING_KEYWORD']
|
|
228
266
|
);
|
|
229
267
|
// THEN
|
|
230
268
|
assert.equal(
|
|
@@ -236,12 +274,12 @@ describe('type: mobileKeyword', () => {
|
|
|
236
274
|
|
|
237
275
|
assert.equal(
|
|
238
276
|
fileList[0].split('\\').join('/'),
|
|
239
|
-
'retrieve/testInstance/testBU/mobileKeyword/
|
|
277
|
+
'retrieve/testInstance/testBU/mobileKeyword/4912312345678.TESTEXISTING_KEYWORD.mobileKeyword-meta.json',
|
|
240
278
|
'wrong JSON path'
|
|
241
279
|
);
|
|
242
280
|
assert.equal(
|
|
243
281
|
fileList[1].split('\\').join('/'),
|
|
244
|
-
'retrieve/testInstance/testBU/mobileKeyword/
|
|
282
|
+
'retrieve/testInstance/testBU/mobileKeyword/4912312345678.TESTEXISTING_KEYWORD.mobileKeyword-meta.amp',
|
|
245
283
|
'wrong AMP path'
|
|
246
284
|
);
|
|
247
285
|
return;
|