@@ -80,7 +80,7 @@ describe("syncSpecsLogs", () => {
80
80
81
81
it ( 'should return proper request option for polling' , ( ) => {
82
82
let options = getOptions ( auth , build_id ) ;
83
- expect ( options . url ) . to . equal ( `${ config . buildUrl } ${ build_id } ` ) ;
83
+ expect ( options . url ) . to . equal ( `${ config . buildUrlV2 } ${ build_id } ` ) ;
84
84
expect ( options . auth . user ) . to . equal ( auth . username ) ;
85
85
expect ( options . auth . password ) . to . equal ( auth . access_key ) ;
86
86
expect ( options . headers [ "Content-Type" ] ) . to . equal ( "application/json" ) ;
@@ -93,6 +93,8 @@ describe("syncSpecsLogs", () => {
93
93
"buildError" : null ,
94
94
"specs" : [ ] ,
95
95
"duration" : null ,
96
+ "parallels" : null ,
97
+ "cliDuration" : null ,
96
98
"customErrorsToPrint" : [
97
99
{ id : "custom_error_1" , type : "custom_errors_to_print" , level : "warn" , should_be_unique : true , message : "custom error message" }
98
100
]
@@ -216,35 +218,38 @@ describe("syncSpecsLogs", () => {
216
218
217
219
context ( "showSpecsStatus" , ( ) => {
218
220
const showSpecsStatus = syncSpecsLogs . __get__ ( "showSpecsStatus" ) ;
221
+ const buildCreatedStatusCode = 202
222
+ const buildRunningStatusCode = 204
223
+ const buildCompletedStatusCode = 200
219
224
220
225
it ( 'should not print initial log for running specs when it is the 1st polling response' , ( ) => {
221
- let data = JSON . stringify ( [ "created" ] )
226
+ let data = JSON . stringify ( { "specData" : [ "created" ] , "buildData" : { "duration" : "NA" , "parallels" : "NA" } } )
222
227
var printInitialLog = sandbox . stub ( ) ;
223
228
syncSpecsLogs . __set__ ( 'printInitialLog' , printInitialLog ) ;
224
229
225
- showSpecsStatus ( data ) ;
230
+ showSpecsStatus ( data , buildCreatedStatusCode ) ;
226
231
227
232
expect ( printInitialLog . calledOnce ) . to . be . false ;
228
233
} ) ;
229
234
230
235
it ( 'should print spec details when spec related data is sent in polling response' , ( ) => {
231
236
let specResult = JSON . stringify ( { "path" : "path" } )
232
- let data = JSON . stringify ( [ specResult ] )
237
+ let data = JSON . stringify ( { "specData" : [ specResult ] , "buildData" : { "duration" : "NA" , "parallels" : "NA" } } )
233
238
var printSpecData = sandbox . stub ( ) ;
234
239
syncSpecsLogs . __set__ ( 'printSpecData' , printSpecData ) ;
235
- showSpecsStatus ( data ) ;
240
+ showSpecsStatus ( data , buildRunningStatusCode ) ;
236
241
expect ( printSpecData . calledOnce ) . to . be . true ;
237
242
} ) ;
238
243
239
244
it ( 'should print initial and spec details when spec related data is sent in polling response' , ( ) => {
240
245
let specResult = JSON . stringify ( { "path" : "path" } )
241
246
syncSpecsLogs . __set__ ( 'buildStarted' , false )
242
- let data = JSON . stringify ( [ "created" , specResult ] )
247
+ let data = JSON . stringify ( { "specData" : [ specResult ] , "buildData" : { "duration" : "NA" , "parallels" : "NA" } } )
243
248
var printSpecData = sandbox . stub ( ) ;
244
249
syncSpecsLogs . __set__ ( 'printSpecData' , printSpecData ) ;
245
250
var printInitialLog = sandbox . stub ( ) ;
246
251
syncSpecsLogs . __set__ ( 'printInitialLog' , printInitialLog ) ;
247
- showSpecsStatus ( data ) ;
252
+ showSpecsStatus ( data , buildCreatedStatusCode ) ;
248
253
expect ( printSpecData . calledOnce ) . to . be . true ;
249
254
expect ( printInitialLog . calledOnce ) . to . be . true ;
250
255
} ) ;
@@ -253,14 +258,14 @@ describe("syncSpecsLogs", () => {
253
258
let specResult = JSON . stringify ( { "path" : "path" } )
254
259
let customError = { id : "custom_error_1" , type : "custom_errors_to_print" , level : "warn" , should_be_unique : true , message : "custom error message" }
255
260
syncSpecsLogs . __set__ ( 'buildStarted' , false )
256
- let data = JSON . stringify ( [ "created" , specResult , customError ] )
261
+ let data = JSON . stringify ( { "specData" : [ "created" , specResult , customError ] , "buildData" : { "duration" : "NA" , "parallels" : "NA" } } )
257
262
var printSpecData = sandbox . stub ( ) ;
258
263
syncSpecsLogs . __set__ ( 'printSpecData' , printSpecData ) ;
259
264
var printInitialLog = sandbox . stub ( ) ;
260
265
syncSpecsLogs . __set__ ( 'printInitialLog' , printInitialLog ) ;
261
266
var addCustomErrorToPrint = sandbox . stub ( ) ;
262
267
syncSpecsLogs . __set__ ( 'addCustomErrorToPrint' , addCustomErrorToPrint ) ;
263
- showSpecsStatus ( data ) ;
268
+ showSpecsStatus ( data , buildRunningStatusCode ) ;
264
269
expect ( printSpecData . calledOnce ) . to . be . true ;
265
270
expect ( printInitialLog . calledOnce ) . to . be . true ;
266
271
expect ( addCustomErrorToPrint . calledOnce ) . to . be . true ;
@@ -307,7 +312,7 @@ describe("syncSpecsLogs", () => {
307
312
expect ( tableStream . calledOnce ) . to . be . true ;
308
313
expect ( whileProcess . calledOnce ) . to . be . false ;
309
314
expect ( specSummary . specs ) . deep . to . equal ( [ ] )
310
- expect ( specSummary . duration ) . to . eql ( endTime - startTime ) ;
315
+ expect ( specSummary . cliDuration ) . to . eql ( endTime - startTime ) ;
311
316
} ) ;
312
317
} ) ;
313
318
@@ -322,7 +327,7 @@ describe("syncSpecsLogs", () => {
322
327
expect ( getTableConfig . calledOnce ) . to . be . true ;
323
328
expect ( tableStream . calledOnce ) . to . be . true ;
324
329
expect ( whileProcess . callCount ) . to . eql ( 3 ) ;
325
- expect ( specSummary . duration ) . to . eql ( endTime - startTime ) ;
330
+ expect ( specSummary . cliDuration ) . to . eql ( endTime - startTime ) ;
326
331
} ) ;
327
332
} ) ;
328
333
} ) ;
0 commit comments