Skip to content

Commit 73b10e3

Browse files
#841: code review improvements
1 parent 7df0bba commit 73b10e3

5 files changed

Lines changed: 48 additions & 13 deletions

File tree

@types/lib/metadataTypes/DataFilter.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/metadataTypes/FileLocation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class FileLocation extends MetadataType {
9494
}
9595

9696
/**
97-
* helper for {@link parseResponseBody} that creates a custom key field for this type based on mobileCode and keyword
97+
* helper for {@link MetadataType.parseResponseBody} that creates a custom key field for this type based on mobileCode and keyword
9898
*
9999
* @param {MetadataTypeItem} metadata single item
100100
*/

test/resources/9999999/data/v1/filetransferlocation/testExisting_fileLocation_aws/patch-response.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"fileTransferLocation": {
33
"customerKey": "testExisting_fileLocation_aws",
44
"name": "testExisting_fileLocation_aws_name",
5-
"description": "",
5+
"description": "updated via deploy",
66
"locationType": "AmazonSimpleStorage",
77
"awsFileTransferLocation": {
88
"regionName": "eucentral1",

test/resources/9999999/fileLocation/patch-aws-expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"customerKey": "testExisting_fileLocation_aws",
3-
"description": "",
3+
"description": "updated via deploy",
44
"name": "testExisting_fileLocation_aws_name",
55
"awsFileTransferLocation": {
66
"accessKeyId": "key-id",

test/type.fileLocation.test.js

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,15 @@ describe('type: fileLocation', () => {
4545
'returned JSON was not equal expected'
4646
);
4747
assert.deepEqual(
48-
await testUtils.getActualJson('testExisting_fileLocation_gcp', 'fileLocation'),
49-
await testUtils.getExpectedJson('9999999', 'fileLocation', 'get-gcp'),
48+
await testUtils.getActualJson('testExisting_fileLocation_azure', 'fileLocation'),
49+
await testUtils.getExpectedJson('9999999', 'fileLocation', 'get-azure'),
5050
'returned JSON was not equal expected'
5151
);
5252
assert.deepEqual(
5353
await testUtils.getActualJson('testExisting_fileLocation_aws', 'fileLocation'),
5454
await testUtils.getExpectedJson('9999999', 'fileLocation', 'get-aws'),
5555
'returned JSON was not equal expected'
5656
);
57-
assert.deepEqual(
58-
await testUtils.getActualJson('testExisting_fileLocation_azure', 'fileLocation'),
59-
await testUtils.getExpectedJson('9999999', 'fileLocation', 'get-azure'),
60-
'returned JSON was not equal expected'
61-
);
6257
assert.deepEqual(
6358
await testUtils.getActualJson('testExisting_fileLocation_exsftp', 'fileLocation'),
6459
await testUtils.getExpectedJson('9999999', 'fileLocation', 'get-exsftp'),
@@ -138,9 +133,13 @@ describe('type: fileLocation', () => {
138133

139134
it('Should update fileLocations', async () => {
140135
// WHEN
141-
const deployed = await handler.deploy('testInstance/testBU', ['fileLocation']);
136+
const deployed = await handler.deploy(
137+
'testInstance/testBU',
138+
['fileLocation'],
139+
['testExisting_fileLocation_exsftp', 'testExisting_fileLocation_aws']
140+
);
142141
// THEN
143-
assert.equal(process.exitCode, 1, 'deploy should not have thrown an error');
142+
assert.equal(process.exitCode, 0, 'deploy should not have thrown an error');
144143
// get results from cache
145144
const result = cache.getCache();
146145
assert.equal(
@@ -156,6 +155,9 @@ describe('type: fileLocation', () => {
156155
'unexpected number of fileLocations deployed'
157156
);
158157
// confirm created item
158+
// TODO
159+
160+
// confirm updated item
159161
assert.deepEqual(
160162
await testUtils.getActualJson('testExisting_fileLocation_exsftp', 'fileLocation'),
161163
await testUtils.getExpectedJson('9999999', 'fileLocation', 'patch-exsftp'),
@@ -175,6 +177,39 @@ describe('type: fileLocation', () => {
175177
);
176178
return;
177179
});
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+
});
178213
});
179214

180215
describe('Templating ================', () => {

0 commit comments

Comments
 (0)