Skip to content

Commit 4e1d2e8

Browse files
author
Shashikant Kadam
committed
fix timeComponents logic and add zip breakup
1 parent 8abd3cf commit 4e1d2e8

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

bin/commands/runs.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,17 @@ module.exports = function run(args) {
8181

8282
markBlockEnd('preArchiveSteps');
8383
// Archive the spec files
84-
markBlockStart('archive');
84+
markBlockStart('zip');
85+
markBlockStart('zip.archive');
8586
return archiver.archive(bsConfig.run_settings, config.fileName, args.exclude).then(function (data) {
8687

87-
markBlockEnd('archive');
88+
markBlockEnd('zip.archive');
8889
// Uploaded zip file
89-
markBlockStart('zipUpload');
90+
markBlockStart('zip.zipUpload');
9091
return zipUploader.zipUpload(bsConfig, config.fileName).then(async function (zip) {
9192

92-
markBlockEnd('zipUpload');
93+
markBlockEnd('zip.zipUpload');
94+
markBlockEnd('zip');
9395
// Create build
9496

9597
//setup Local Testing

bin/helpers/timeComponents.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ const convertDotToNestedObject = (dotNotationObject) => {
4646
}
4747
currentKey = currentKey[dotKeys[i]];
4848
}
49-
currentKey[dotKeys[dotKeys.length - 1]] = dotNotationObject[key];
49+
if (isUndefined(currentKey[dotKeys[dotKeys.length - 1]]) || Number.isInteger(currentKey[dotKeys[dotKeys.length - 1]])) {
50+
currentKey[dotKeys[dotKeys.length - 1]] = dotNotationObject[key];
51+
} else {
52+
currentKey[dotKeys[dotKeys.length - 1]].total = dotNotationObject[key];
53+
}
5054
});
5155

5256
return nestedObject;

test/unit/bin/helpers/timeComponents.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ describe('timeComponents', () => {
103103
{'block1.block2.block3.block4.block5': 50},
104104
{block1:10,'block2.block3':20},
105105
{block1:10,'block2.block3':30,'block2.block4':40},
106-
{'block1.block2':10,'block2':20,'block1.block2.block3':30,'block2.block3':30,block4:40}
106+
{'block1.block2':10,'block2':20,'block1.block2.block3':30,'block2.block3':30,block4:40},
107+
{'block1.block2':10, 'block1.block3':20, 'block1':20}
107108
];
108109
let outputs = [
109110
{},
@@ -114,7 +115,8 @@ describe('timeComponents', () => {
114115
{block1:{block2:{block3:{block4:{block5:50}}}}},
115116
{block1:10,block2:{block3:20}},
116117
{block1:10, block2:{block3:30,block4:40}},
117-
{block1:{block2:{total:10,block3:30}},block2:{total:20,block3:30},block4:40}
118+
{block1:{block2:{total:10,block3:30}},block2:{total:20,block3:30},block4:40},
119+
{block1:{block2:10,block3:20,total:20}}
118120
];
119121

120122
it('should convert dotted object to nested object', () => {

0 commit comments

Comments
 (0)