mcdev 5.2.0 → 5.3.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.
Files changed (106) hide show
  1. package/.fork/custom-commands.json +12 -0
  2. package/.github/ISSUE_TEMPLATE/bug.yml +1 -0
  3. package/.github/PULL_REQUEST_TEMPLATE/pr_template_release.md +19 -0
  4. package/docs/dist/documentation.md +400 -9
  5. package/lib/MetadataTypeDefinitions.js +1 -0
  6. package/lib/MetadataTypeInfo.js +1 -0
  7. package/lib/cli.js +6 -1
  8. package/lib/index.js +4 -1
  9. package/lib/metadataTypes/AttributeSet.js +118 -11
  10. package/lib/metadataTypes/Automation.js +99 -70
  11. package/lib/metadataTypes/DataExtension.js +463 -66
  12. package/lib/metadataTypes/DataExtensionField.js +30 -13
  13. package/lib/metadataTypes/Journey.js +8 -1
  14. package/lib/metadataTypes/MetadataType.js +63 -5
  15. package/lib/metadataTypes/MobileKeyword.js +1 -1
  16. package/lib/metadataTypes/TransactionalEmail.js +94 -17
  17. package/lib/metadataTypes/TransactionalMessage.js +3 -2
  18. package/lib/metadataTypes/Verification.js +230 -0
  19. package/lib/metadataTypes/definitions/AttributeGroup.definition.js +2 -2
  20. package/lib/metadataTypes/definitions/AttributeSet.definition.js +74 -21
  21. package/lib/metadataTypes/definitions/Automation.definition.js +1 -0
  22. package/lib/metadataTypes/definitions/TransactionalEmail.definition.js +19 -1
  23. package/lib/metadataTypes/definitions/Verification.definition.js +88 -0
  24. package/package.json +6 -6
  25. package/test/mockRoot/.mcdevrc.json +1 -1
  26. package/test/mockRoot/deploy/testInstance/_ParentBU_/dataExtension/testExisting_dataExtensionShared.dataExtension-meta.json +59 -0
  27. package/test/mockRoot/deploy/testInstance/_ParentBU_/dataExtension/testNew_dataExtensionShared.dataExtension-meta.json +23 -0
  28. package/test/mockRoot/deploy/testInstance/testBU/automation/testNew_automation.automation-meta.json +4 -0
  29. package/test/mockRoot/deploy/testInstance/testBU/dataExtension/testExisting_dataExtension.dataExtension-meta.json +1 -0
  30. package/test/mockRoot/deploy/testInstance/testBU/transactionalEmail/testExisting_temail.transactionalEmail-meta.json +3 -4
  31. package/test/mockRoot/deploy/testInstance/testBU/transactionalEmail/testNew_temail.transactionalEmail-meta.json +1 -6
  32. package/test/mockRoot/deploy/testInstance/testBU/verification/testExisting_39f6a488-20eb-4ba0-b0b9.verification-meta.json +11 -0
  33. package/test/mockRoot/deploy/testInstance/testBU/verification/testNew_39f6a488-20eb-4ba0-b0b9.verification-meta.json +11 -0
  34. package/test/resources/1111111/data/v1/customobjectdata/key/testExisting_dataExtensionShared/rowset/get-response.json +13 -0
  35. package/test/resources/1111111/dataExtension/create-expected.json +23 -0
  36. package/test/resources/1111111/dataExtension/create-response.xml +59 -0
  37. package/test/resources/1111111/dataExtension/retrieve-expected.json +55 -0
  38. package/test/resources/1111111/dataExtension/retrieve-expected.md +18 -0
  39. package/test/resources/1111111/dataExtension/retrieve-response.xml +27 -1
  40. package/test/resources/1111111/dataExtension/update-expected.json +55 -0
  41. package/test/resources/1111111/dataExtension/update-response.xml +57 -0
  42. package/test/resources/1111111/dataExtensionField/retrieve-CustomerKey=[testExisting_dataExtensionShared].[TriggerUpdate_randomNumber_]-response.xml +45 -0
  43. package/test/resources/1111111/dataExtensionField/retrieve-DataExtension.CustomerKey=testExisting_dataExtensionShared-response.xml +98 -0
  44. package/test/resources/1111111/dataExtensionField/retrieve-DataExtension.CustomerKey=testNew_dataExtensionSharedORDataExtension.CustomerKey=testExisting_dataExtensionShared-response.xml +98 -0
  45. package/test/resources/1111111/dataExtensionField/retrieve-response.xml +98 -0
  46. package/test/resources/1111111/dataExtensionTemplate/retrieve-response.xml +303 -0
  47. package/test/resources/1111111/dataFolder/retrieve-ContentType=synchronizeddataextensionORContentType=shared_salesforcedataextensionORContentType=shared_dataextensionORContentType=shared_dataORContentType=salesforcedataextensionORContentType=dataextensionORContentType=hidden-response.xml +387 -0
  48. package/test/resources/1111111/dataFolder/retrieve-response.xml +353 -9
  49. package/test/resources/9999999/attributeSet/retrieve-expected.json +89 -694
  50. package/test/resources/9999999/automation/build-expected.json +4 -0
  51. package/test/resources/9999999/automation/create-expected.json +4 -0
  52. package/test/resources/9999999/automation/create-testNew_automation-expected.md +1 -0
  53. package/test/resources/9999999/automation/retrieve-expected.json +4 -0
  54. package/test/resources/9999999/automation/retrieve-testExisting_automation-expected.md +1 -0
  55. package/test/resources/9999999/automation/template-expected.json +4 -0
  56. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-1f7f8788c560/get-response.json +7 -0
  57. package/test/resources/9999999/automation/v1/automations/post-response.json +7 -0
  58. package/test/resources/9999999/automation/v1/dataverifications/post-response.json +12 -0
  59. package/test/resources/9999999/automation/v1/dataverifications/testExisting_39f6a488-20eb-4ba0-b0b9/delete-response.json +0 -0
  60. package/test/resources/9999999/automation/v1/dataverifications/testExisting_39f6a488-20eb-4ba0-b0b9/get-response.json +12 -0
  61. package/test/resources/9999999/automation/v1/dataverifications/testExisting_39f6a488-20eb-4ba0-b0b9/patch-response.json +12 -0
  62. package/test/resources/9999999/dataExtension/build-expected.json +16 -0
  63. package/test/resources/9999999/dataExtension/delete-response.xml +42 -0
  64. package/test/resources/9999999/dataExtension/retrieve-expected.json +16 -0
  65. package/test/resources/9999999/dataExtension/retrieve-expected.md +3 -1
  66. package/test/resources/9999999/dataExtension/template-expected.json +16 -0
  67. package/test/resources/9999999/dataExtension/update-expected.json +17 -1
  68. package/test/resources/9999999/dataExtensionField/retrieve-CustomerKey=[testExisting_dataExtension].[LastName]-response.xml +44 -0
  69. package/test/resources/9999999/dataExtensionField/retrieve-DataExtension.CustomerKey=testExisting_dataExtension-response.xml +36 -1
  70. package/test/resources/9999999/dataExtensionField/retrieve-response.xml +36 -1
  71. package/test/resources/9999999/dataFolder/retrieve-ContentType=synchronizeddataextensionORContentType=shared_salesforcedataextensionORContentType=shared_dataextensionORContentType=shared_dataORContentType=salesforcedataextensionORContentType=dataextensionORContentType=hidden-response.xml +117 -0
  72. package/test/resources/9999999/hub/v1/contacts/schema/attributeGroups/get-response.json +43 -0
  73. package/test/resources/9999999/hub/v1/contacts/schema/setDefinitions/get-response.json +387 -0
  74. package/test/resources/9999999/interaction/v1/interactions/233d4413-922c-4568-85a5-e5cc77efc3be/delete-response.json +1 -0
  75. package/test/resources/9999999/legacy/v1/beta/bulk/automations/automation/definition/get-response.json +1 -1
  76. package/test/resources/9999999/messaging/v1/email/definitions/post-response.json +1 -1
  77. package/test/resources/9999999/messaging/v1/email/definitions/testExisting_temail/delete-response.json +6 -0
  78. package/test/resources/9999999/transactionalEmail/build-expected.json +3 -7
  79. package/test/resources/9999999/transactionalEmail/get-expected.json +3 -7
  80. package/test/resources/9999999/transactionalEmail/patch-expected.json +3 -7
  81. package/test/resources/9999999/transactionalEmail/post-expected.json +3 -7
  82. package/test/resources/9999999/transactionalEmail/template-expected.json +3 -7
  83. package/test/resources/9999999/verification/build-expected.json +11 -0
  84. package/test/resources/9999999/verification/get-expected.json +11 -0
  85. package/test/resources/9999999/verification/patch-expected.json +11 -0
  86. package/test/resources/9999999/verification/post-expected.json +11 -0
  87. package/test/resources/9999999/verification/template-expected.json +11 -0
  88. package/test/type.attributeGroup.test.js +4 -4
  89. package/test/type.attributeSet.test.js +5 -5
  90. package/test/type.automation.test.js +29 -23
  91. package/test/type.dataExtension.test.js +205 -45
  92. package/test/type.dataExtract.test.js +10 -3
  93. package/test/type.fileTransfer.test.js +10 -3
  94. package/test/type.importFile.test.js +10 -3
  95. package/test/type.journey.test.js +38 -11
  96. package/test/type.mobileKeyword.test.js +6 -4
  97. package/test/type.mobileMessage.test.js +6 -4
  98. package/test/type.query.test.js +8 -6
  99. package/test/type.script.test.js +6 -1
  100. package/test/type.transactionalEmail.test.js +12 -11
  101. package/test/type.transactionalPush.test.js +2 -4
  102. package/test/type.transactionalSMS.test.js +2 -4
  103. package/test/type.triggeredSend.test.js +6 -4
  104. package/test/type.verification.test.js +173 -0
  105. package/test/utils.js +7 -1
  106. package/types/mcdev.d.js +14 -0
@@ -47,10 +47,9 @@ describe('type: automation', () => {
47
47
  )
48
48
  )
49
49
  );
50
-
51
50
  assert.equal(
52
51
  testUtils.getAPIHistoryLength(),
53
- 17,
52
+ 18,
54
53
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
55
54
  );
56
55
  return;
@@ -62,7 +61,11 @@ describe('type: automation', () => {
62
61
  });
63
62
  it('Should create & update a automation', async () => {
64
63
  // WHEN
65
- const deployResult = await handler.deploy('testInstance/testBU', ['automation']);
64
+ const deployResult = await handler.deploy(
65
+ 'testInstance/testBU',
66
+ ['automation', 'verification'],
67
+ ['testExisting_automation', 'testNew_automation', 'testNew_39f6a488-20eb-4ba0-b0b9']
68
+ );
66
69
  // THEN
67
70
  assert.equal(process.exitCode, false, 'deploy should not have thrown an error');
68
71
 
@@ -120,7 +123,7 @@ describe('type: automation', () => {
120
123
 
121
124
  assert.equal(
122
125
  testUtils.getAPIHistoryLength(),
123
- 16,
126
+ 25,
124
127
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
125
128
  );
126
129
  return;
@@ -130,8 +133,8 @@ describe('type: automation', () => {
130
133
  handler.setOptions({ schedule: true });
131
134
  const deployed = await handler.deploy(
132
135
  'testInstance/testBU',
133
- ['automation'],
134
- ['testExisting_automation', 'testNew_automation']
136
+ ['automation', 'verification'],
137
+ ['testExisting_automation', 'testNew_automation', 'testNew_39f6a488-20eb-4ba0-b0b9']
135
138
  );
136
139
  // THEN
137
140
  assert.equal(
@@ -189,7 +192,7 @@ describe('type: automation', () => {
189
192
 
190
193
  assert.equal(
191
194
  testUtils.getAPIHistoryLength(),
192
- 24,
195
+ 33,
193
196
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
194
197
  );
195
198
  return;
@@ -199,8 +202,8 @@ describe('type: automation', () => {
199
202
  handler.setOptions({ execute: true });
200
203
  const deployed = await handler.deploy(
201
204
  'testInstance/testBU',
202
- ['automation'],
203
- ['testExisting_automation', 'testNew_automation']
205
+ ['automation', 'verification'],
206
+ ['testExisting_automation', 'testNew_automation', 'testNew_39f6a488-20eb-4ba0-b0b9']
204
207
  );
205
208
  // THEN
206
209
  assert.equal(
@@ -257,7 +260,7 @@ describe('type: automation', () => {
257
260
 
258
261
  assert.equal(
259
262
  testUtils.getAPIHistoryLength(),
260
- 20,
263
+ 29,
261
264
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
262
265
  );
263
266
  return;
@@ -289,10 +292,11 @@ describe('type: automation', () => {
289
292
  1,
290
293
  'one automation expected'
291
294
  );
295
+ testUtils.logAPIHistoryDebug();
292
296
  // check number of API calls
293
297
  assert.equal(
294
298
  testUtils.getAPIHistoryLength(),
295
- 14,
299
+ 18,
296
300
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
297
301
  );
298
302
  return;
@@ -336,7 +340,7 @@ describe('type: automation', () => {
336
340
  // check number of API calls
337
341
  assert.equal(
338
342
  testUtils.getAPIHistoryLength(),
339
- 29,
343
+ 40,
340
344
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
341
345
  );
342
346
  return;
@@ -380,7 +384,7 @@ describe('type: automation', () => {
380
384
  // check number of API calls
381
385
  assert.equal(
382
386
  testUtils.getAPIHistoryLength(),
383
- 31,
387
+ 42,
384
388
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
385
389
  );
386
390
  return;
@@ -424,7 +428,7 @@ describe('type: automation', () => {
424
428
  // check number of API calls
425
429
  assert.equal(
426
430
  testUtils.getAPIHistoryLength(),
427
- 32,
431
+ 43,
428
432
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
429
433
  );
430
434
  return;
@@ -464,7 +468,7 @@ describe('type: automation', () => {
464
468
  // check number of API calls
465
469
  assert.equal(
466
470
  testUtils.getAPIHistoryLength(),
467
- 26,
471
+ 35,
468
472
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
469
473
  );
470
474
  return;
@@ -505,7 +509,7 @@ describe('type: automation', () => {
505
509
  // check number of API calls
506
510
  assert.equal(
507
511
  testUtils.getAPIHistoryLength(),
508
- 30,
512
+ 41,
509
513
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
510
514
  );
511
515
  return;
@@ -546,7 +550,7 @@ describe('type: automation', () => {
546
550
  // check number of API calls
547
551
  assert.equal(
548
552
  testUtils.getAPIHistoryLength(),
549
- 32,
553
+ 43,
550
554
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
551
555
  );
552
556
  return;
@@ -597,7 +601,7 @@ describe('type: automation', () => {
597
601
  );
598
602
  assert.equal(
599
603
  testUtils.getAPIHistoryLength(),
600
- 14,
604
+ 20,
601
605
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
602
606
  );
603
607
  return;
@@ -644,7 +648,7 @@ describe('type: automation', () => {
644
648
  );
645
649
  assert.equal(
646
650
  testUtils.getAPIHistoryLength(),
647
- 17,
651
+ 18,
648
652
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
649
653
  );
650
654
  return;
@@ -653,13 +657,15 @@ describe('type: automation', () => {
653
657
  describe('Delete ================', () => {
654
658
  it('Should delete the item', async () => {
655
659
  // WHEN
656
- const result = await handler.deleteByKey('testInstance/testBU', 'automation', [
657
- 'testExisting_automation',
658
- ]);
660
+ const isDeleted = await handler.deleteByKey(
661
+ 'testInstance/testBU',
662
+ 'automation',
663
+ 'testExisting_automation'
664
+ );
659
665
  // THEN
660
666
  assert.equal(process.exitCode, false, 'delete should not have thrown an error');
661
667
 
662
- assert.equal(result, true, 'should have deleted the item');
668
+ assert.equal(isDeleted, true, 'should have deleted the item');
663
669
  return;
664
670
  });
665
671
  });
@@ -50,23 +50,73 @@ describe('type: dataExtension', () => {
50
50
  );
51
51
  return;
52
52
  });
53
+ it('Should retrieve a shared dataExtension', async () => {
54
+ // WHEN
55
+ await handler.retrieve('testInstance/_ParentBU_', ['dataExtension']);
56
+ // THEN
57
+ assert.equal(process.exitCode, false, 'retrieve should not have thrown an error');
58
+ // get results from cache
59
+ const result = cache.getCache();
60
+ assert.equal(
61
+ result.dataExtension ? Object.keys(result.dataExtension).length : 0,
62
+ 1,
63
+ 'only one dataExtension expected'
64
+ );
65
+ assert.deepEqual(
66
+ await testUtils.getActualJson(
67
+ 'testExisting_dataExtensionShared',
68
+ 'dataExtension',
69
+ '_ParentBU_'
70
+ ),
71
+ await testUtils.getExpectedJson('1111111', 'dataExtension', 'retrieve'),
72
+
73
+ 'returned metadata was not equal expected'
74
+ );
75
+ // check if MD file was created and equals expectations
76
+ expect(
77
+ file(
78
+ testUtils.getActualDoc(
79
+ 'testExisting_dataExtensionShared',
80
+ 'dataExtension',
81
+ '_ParentBU_'
82
+ )
83
+ )
84
+ ).to.equal(
85
+ file(testUtils.getExpectedFile('1111111', 'dataExtension', 'retrieve', 'md'))
86
+ );
87
+
88
+ assert.equal(
89
+ testUtils.getAPIHistoryLength(),
90
+ 4,
91
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
92
+ );
93
+ return;
94
+ });
53
95
  });
54
96
  describe('Deploy ================', () => {
55
97
  beforeEach(() => {
56
98
  testUtils.mockSetup(true);
57
99
  });
58
- it('Should create & update a dataExtension', async () => {
100
+ it('Should create & update a dataExtension including a field rename', async () => {
59
101
  // WHEN
60
- await handler.deploy('testInstance/testBU', ['dataExtension']);
102
+ const deployResult = await handler.deploy('testInstance/testBU', ['dataExtension']);
61
103
  // THEN
62
104
  assert.equal(process.exitCode, false, 'deploy should not have thrown an error');
63
105
 
106
+ assert.equal(
107
+ deployResult['testInstance/testBU']?.dataExtension
108
+ ? Object.keys(deployResult['testInstance/testBU']?.dataExtension).length
109
+ : 0,
110
+ 2,
111
+ 'two dataExtensions to be deployed'
112
+ );
113
+
64
114
  // get results from cache
65
115
  const result = cache.getCache();
66
116
  assert.equal(
67
117
  result.dataExtension ? Object.keys(result.dataExtension).length : 0,
68
- 2,
69
- 'two dataExtensions expected'
118
+ 3,
119
+ 'three dataExtensions expected'
70
120
  );
71
121
  // insert
72
122
  assert.deepEqual(
@@ -87,7 +137,104 @@ describe('type: dataExtension', () => {
87
137
  );
88
138
  return;
89
139
  });
90
- it('Should rename fields');
140
+ it('Should create & update a shared dataExtension', async () => {
141
+ // WHEN
142
+ const deployResult = await handler.deploy('testInstance/_ParentBU_', ['dataExtension']);
143
+ // THEN
144
+ assert.equal(process.exitCode, false, 'deploy should not have thrown an error');
145
+
146
+ assert.equal(
147
+ deployResult['testInstance/_ParentBU_']?.dataExtension
148
+ ? Object.keys(deployResult['testInstance/_ParentBU_']?.dataExtension).length
149
+ : 0,
150
+ 2,
151
+ 'two dataExtensions to be deployed'
152
+ );
153
+
154
+ // get results from cache
155
+ const result = cache.getCache();
156
+ assert.equal(
157
+ result.dataExtension ? Object.keys(result.dataExtension).length : 0,
158
+ 2,
159
+ 'two dataExtensions expected'
160
+ );
161
+ // insert
162
+ assert.deepEqual(
163
+ await testUtils.getActualJson(
164
+ 'testNew_dataExtensionShared',
165
+ 'dataExtension',
166
+ '_ParentBU_'
167
+ ),
168
+ await testUtils.getExpectedJson('1111111', 'dataExtension', 'create'),
169
+ 'returned metadata was not equal expected for create'
170
+ );
171
+ // update
172
+ assert.deepEqual(
173
+ await testUtils.getActualJson(
174
+ 'testExisting_dataExtensionShared',
175
+ 'dataExtension',
176
+ '_ParentBU_'
177
+ ),
178
+ await testUtils.getExpectedJson('1111111', 'dataExtension', 'update'),
179
+ 'returned metadata was not equal expected for update'
180
+ );
181
+ assert.equal(
182
+ testUtils.getAPIHistoryLength(),
183
+ 8,
184
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
185
+ );
186
+ return;
187
+ });
188
+ it('Should create & update a shared dataExtension with --fixShared & --skipInteraction', async () => {
189
+ // WHEN
190
+ handler.setOptions({ fixShared: 'testBU', skipInteraction: true, _runningTest: true });
191
+
192
+ const deployResult = await handler.deploy('testInstance/_ParentBU_', ['dataExtension']);
193
+ // THEN
194
+ assert.equal(process.exitCode, false, 'deploy should not have thrown an error');
195
+
196
+ assert.equal(
197
+ deployResult['testInstance/_ParentBU_']?.dataExtension
198
+ ? Object.keys(deployResult['testInstance/_ParentBU_']?.dataExtension).length
199
+ : 0,
200
+ 2,
201
+ 'two dataExtensions to be deployed'
202
+ );
203
+
204
+ // get results from cache
205
+ const result = cache.getCache();
206
+ assert.equal(
207
+ result.dataExtension ? Object.keys(result.dataExtension).length : 0,
208
+ 2,
209
+ 'two dataExtensions expected'
210
+ );
211
+ // insert
212
+ assert.deepEqual(
213
+ await testUtils.getActualJson(
214
+ 'testNew_dataExtensionShared',
215
+ 'dataExtension',
216
+ '_ParentBU_'
217
+ ),
218
+ await testUtils.getExpectedJson('1111111', 'dataExtension', 'create'),
219
+ 'returned metadata was not equal expected for create'
220
+ );
221
+ // update
222
+ assert.deepEqual(
223
+ await testUtils.getActualJson(
224
+ 'testExisting_dataExtensionShared',
225
+ 'dataExtension',
226
+ '_ParentBU_'
227
+ ),
228
+ await testUtils.getExpectedJson('1111111', 'dataExtension', 'update'),
229
+ 'returned metadata was not equal expected for update'
230
+ );
231
+ assert.equal(
232
+ testUtils.getAPIHistoryLength(),
233
+ 12,
234
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
235
+ );
236
+ return;
237
+ });
91
238
  });
92
239
  describe('Templating ================', () => {
93
240
  it('Should create a dataExtension template via retrieveAsTemplate and build it', async () => {
@@ -194,47 +341,60 @@ describe('type: dataExtension', () => {
194
341
  });
195
342
  });
196
343
  describe('Delete ================', () => {
197
- // TODO: add this test
198
- it('Should delete the item'); // , async () => {
199
- // // WHEN
200
- // const result = await handler.deleteByKey('testInstance/testBU', 'mobileKeyword', [
201
- // 'testExisting_keyword',
202
- // ]);
203
- // // THEN
204
- // assert.equal(process.exitCode, false, 'delete should not have thrown an error');
205
-
206
- // assert.equal(result, true, 'should have deleted the item');
207
- // return;
208
- // });
344
+ it('Should delete the dataExtension', async () => {
345
+ // WHEN
346
+ const isDeleted = await handler.deleteByKey(
347
+ 'testInstance/testBU',
348
+ 'dataExtension',
349
+ 'testExisting_dataExtension'
350
+ );
351
+ // THEN
352
+ assert.equal(process.exitCode, false, 'delete should not have thrown an error');
353
+
354
+ assert.equal(isDeleted, true, 'should have deleted the item');
355
+ return;
356
+ });
357
+ it('Should delete the dataExtensionField', async () => {
358
+ // WHEN
359
+ const isDeleted = await handler.deleteByKey(
360
+ 'testInstance/testBU',
361
+ 'dataExtensionField',
362
+ 'testExisting_dataExtension.LastName'
363
+ );
364
+ // THEN
365
+ assert.equal(process.exitCode, false, 'delete should not have thrown an error');
366
+
367
+ assert.equal(isDeleted, true, 'should have deleted the item');
368
+ return;
369
+ });
209
370
  });
210
371
  describe('CI/CD ================', () => {
211
- // TODO: add this test
212
- it('Should return a list of files based on their type and key'); // , async () => {
213
- // // WHEN
214
- // const fileList = await handler.getFilesToCommit(
215
- // 'testInstance/testBU',
216
- // 'mobileKeyword',
217
- // ['testExisting_keyword']
218
- // );
219
- // // THEN
220
- // assert.equal(
221
- // process.exitCode,
222
- // false,
223
- // 'getFilesToCommit should not have thrown an error'
224
- // );
225
- // assert.equal(fileList.length, 2, 'expected only 2 file paths');
226
-
227
- // assert.equal(
228
- // fileList[0].split('\\').join('/'),
229
- // 'retrieve/testInstance/testBU/mobileKeyword/testExisting_keyword.mobileKeyword-meta.json',
230
- // 'wrong JSON path'
231
- // );
232
- // assert.equal(
233
- // fileList[1].split('\\').join('/'),
234
- // 'retrieve/testInstance/testBU/mobileKeyword/testExisting_keyword.mobileKeyword-meta.amp',
235
- // 'wrong AMP path'
236
- // );
237
- // return;
238
- // });
372
+ it('Should return a list of files based on their type and key', async () => {
373
+ // WHEN
374
+ const fileList = await handler.getFilesToCommit(
375
+ 'testInstance/testBU',
376
+ 'dataExtension',
377
+ ['testExisting_dataExtension']
378
+ );
379
+ // THEN
380
+ assert.equal(
381
+ process.exitCode,
382
+ false,
383
+ 'getFilesToCommit should not have thrown an error'
384
+ );
385
+ assert.equal(fileList.length, 2, 'expected only 2 file paths (json, md)');
386
+
387
+ assert.equal(
388
+ fileList[0].split('\\').join('/'),
389
+ 'retrieve/testInstance/testBU/dataExtension/testExisting_dataExtension.dataExtension-meta.json',
390
+ 'wrong JSON path'
391
+ );
392
+ assert.equal(
393
+ fileList[1].split('\\').join('/'),
394
+ 'retrieve/testInstance/testBU/dataExtension/testExisting_dataExtension.dataExtension-doc.md',
395
+ 'wrong MD path'
396
+ );
397
+ return;
398
+ });
239
399
  });
240
400
  });
@@ -172,15 +172,22 @@ describe('type: dataExtract', () => {
172
172
  describe('Delete ================', () => {
173
173
  it('Should NOT delete the item', async () => {
174
174
  // WHEN
175
- await handler.deleteByKey('testInstance/testBU', 'dataExtract', [
176
- 'testExisting_fileTranfer',
177
- ]);
175
+ const isDeleted = await handler.deleteByKey(
176
+ 'testInstance/testBU',
177
+ 'dataExtract',
178
+ 'testExisting_fileTranfer'
179
+ );
178
180
  // THEN
179
181
  assert.equal(
180
182
  process.exitCode,
181
183
  1,
182
184
  'deleteByKey should have thrown an error due to lack of support'
183
185
  );
186
+ assert.equal(
187
+ isDeleted,
188
+ false,
189
+ 'deleteByKey should have returned false due to lack of support'
190
+ );
184
191
  return;
185
192
  });
186
193
  });
@@ -170,15 +170,22 @@ describe('type: fileTransfer', () => {
170
170
  describe('Delete ================', () => {
171
171
  it('Should NOT delete the item', async () => {
172
172
  // WHEN
173
- await handler.deleteByKey('testInstance/testBU', 'fileTransfer', [
174
- 'testExisting_fileTranfer',
175
- ]);
173
+ const isDeleted = await handler.deleteByKey(
174
+ 'testInstance/testBU',
175
+ 'fileTransfer',
176
+ 'testExisting_fileTranfer'
177
+ );
176
178
  // THEN
177
179
  assert.equal(
178
180
  process.exitCode,
179
181
  1,
180
182
  'deleteByKey should have thrown an error due to lack of support'
181
183
  );
184
+ assert.equal(
185
+ isDeleted,
186
+ false,
187
+ 'deleteByKey should have returned false due to lack of support'
188
+ );
182
189
  return;
183
190
  });
184
191
  });
@@ -171,15 +171,22 @@ describe('type: importFile', () => {
171
171
  describe('Delete ================', () => {
172
172
  it('Should NOT delete the item', async () => {
173
173
  // WHEN
174
- await handler.deleteByKey('testInstance/testBU', 'importFile', [
175
- 'testExisting_fileTranfer',
176
- ]);
174
+ const isDeleted = await handler.deleteByKey(
175
+ 'testInstance/testBU',
176
+ 'importFile',
177
+ 'testExisting_fileTranfer'
178
+ );
177
179
  // THEN
178
180
  assert.equal(
179
181
  process.exitCode,
180
182
  1,
181
183
  'deleteByKey should have thrown an error due to lack of support'
182
184
  );
185
+ assert.equal(
186
+ isDeleted,
187
+ false,
188
+ 'deleteByKey should have returned false due to lack of support'
189
+ );
183
190
  return;
184
191
  });
185
192
  });
@@ -141,17 +141,44 @@ describe('type: journey', () => {
141
141
  });
142
142
  });
143
143
  describe('Delete ================', () => {
144
- // TODO: add this test
145
- it('Should delete the item'); // , async () => {
146
- // // WHEN
147
- // const result = await handler.deleteByKey('testInstance/testBU', 'mobileKeyword', [
148
- // 'testExisting_keyword',
149
- // ]);
150
- // // THEN
151
- // assert.equal(process.exitCode, false, 'delete should not have thrown an error');
144
+ it('Should NOT delete the item due to missing version', async () => {
145
+ // WHEN
146
+ const isDeleted = await handler.deleteByKey(
147
+ 'testInstance/testBU',
148
+ 'journey',
149
+ 'testExisting_interaction'
150
+ );
151
+ // THEN
152
+ assert.equal(process.exitCode, true, 'delete should have thrown an error');
152
153
 
153
- // assert.equal(result, true, 'should have deleted the item');
154
- // return;
155
- // });
154
+ assert.equal(isDeleted, false, 'should not have deleted the item');
155
+ return;
156
+ });
157
+ it('Should NOT delete the item due to unknown version', async () => {
158
+ // WHEN
159
+ const isDeleted = await handler.deleteByKey(
160
+ 'testInstance/testBU',
161
+ 'journey',
162
+ 'testExisting_interaction/2'
163
+ );
164
+ // THEN
165
+ assert.equal(process.exitCode, true, 'delete should have thrown an error');
166
+
167
+ assert.equal(isDeleted, false, 'should not have deleted the item');
168
+ return;
169
+ });
170
+ it('Should delete the item with version', async () => {
171
+ // WHEN
172
+ const isDeleted = await handler.deleteByKey(
173
+ 'testInstance/testBU',
174
+ 'journey',
175
+ 'testExisting_interaction/1'
176
+ );
177
+ // THEN
178
+ assert.equal(process.exitCode, false, 'delete should not have thrown an error');
179
+
180
+ assert.equal(isDeleted, true, 'should have deleted the item');
181
+ return;
182
+ });
156
183
  });
157
184
  });
@@ -245,13 +245,15 @@ describe('type: mobileKeyword', () => {
245
245
  describe('Delete ================', () => {
246
246
  it('Should delete the item', async () => {
247
247
  // WHEN
248
- const result = await handler.deleteByKey('testInstance/testBU', 'mobileKeyword', [
249
- '4912312345678.TESTEXISTING_KEYWORD',
250
- ]);
248
+ const isDeleted = await handler.deleteByKey(
249
+ 'testInstance/testBU',
250
+ 'mobileKeyword',
251
+ '4912312345678.TESTEXISTING_KEYWORD'
252
+ );
251
253
  // THEN
252
254
  assert.equal(process.exitCode, false, 'delete should not have thrown an error');
253
255
 
254
- assert.equal(result, true, 'should have deleted the item');
256
+ assert.equal(isDeleted, true, 'should have deleted the item');
255
257
  return;
256
258
  });
257
259
  });
@@ -163,13 +163,15 @@ describe('type: mobileMessage', () => {
163
163
  describe('Delete ================', () => {
164
164
  it('Should delete the item', async () => {
165
165
  // WHEN
166
- const result = await handler.deleteByKey('testInstance/testBU', 'mobileMessage', [
167
- 'NTIzOjc4OjA',
168
- ]);
166
+ const isDeleted = await handler.deleteByKey(
167
+ 'testInstance/testBU',
168
+ 'mobileMessage',
169
+ 'NTIzOjc4OjA'
170
+ );
169
171
  // THEN
170
172
  assert.equal(process.exitCode, false, 'delete should not have thrown an error');
171
173
 
172
- assert.equal(result, true, 'should have deleted the item');
174
+ assert.equal(isDeleted, true, 'should have deleted the item');
173
175
  return;
174
176
  });
175
177
  });