@@ -26,6 +26,7 @@ describe("buildInfo", () => {
2626 sandbox = sinon . createSandbox ( ) ;
2727 setUsernameStub = sandbox . stub ( ) ;
2828 setAccessKeyStub = sandbox . stub ( ) ;
29+ getInitialDetailsStub = sandbox . stub ( ) ;
2930 validateBstackJsonStub = sandbox . stub ( ) ;
3031 getConfigPathStub = sandbox . stub ( ) ;
3132 setUsageReportingFlagStub = sandbox . stub ( ) . returns ( undefined ) ;
@@ -54,6 +55,7 @@ describe("buildInfo", () => {
5455 '../helpers/utils' : {
5556 setUsername : setUsernameStub ,
5657 setAccessKey : setAccessKeyStub ,
58+ getInitialDetails : getInitialDetailsStub ,
5759 validateBstackJson : validateBstackJsonStub ,
5860 getErrorCodeFromErr : getErrorCodeFromErrStub ,
5961 sendUsageReport : sendUsageReportStub ,
@@ -68,13 +70,15 @@ describe("buildInfo", () => {
6870 } ) ;
6971
7072 validateBstackJsonStub . returns ( Promise . resolve ( bsConfig ) ) ;
73+ getInitialDetailsStub . returns ( Promise . resolve ( { } ) ) ;
7174
7275 return info ( args , rawArgs )
7376 . then ( function ( _bsConfig ) {
7477 sinon . assert . calledOnce ( requestStub ) ;
7578 sinon . assert . calledOnce ( getConfigPathStub ) ;
7679 sinon . assert . calledOnce ( getUserAgentStub ) ;
77- sinon . assert . calledOnceWithExactly ( sendUsageReportStub , bsConfig , args , message , messageType , errorCode , null , rawArgs ) ;
80+ sinon . assert . calledOnce ( getInitialDetailsStub ) ;
81+ sinon . assert . calledOnceWithExactly ( sendUsageReportStub , bsConfig , args , message , messageType , errorCode , { } , rawArgs ) ;
7882 } ) . catch ( ( error ) => {
7983 chai . assert . isNotOk ( error , 'Promise error' ) ;
8084 } ) ;
@@ -93,6 +97,7 @@ describe("buildInfo", () => {
9397 '../helpers/utils' : {
9498 setUsername : setUsernameStub ,
9599 setAccessKey : setAccessKeyStub ,
100+ getInitialDetails : getInitialDetailsStub ,
96101 validateBstackJson : validateBstackJsonStub ,
97102 getErrorCodeFromErr : getErrorCodeFromErrStub ,
98103 sendUsageReport : sendUsageReportStub ,
@@ -106,14 +111,16 @@ describe("buildInfo", () => {
106111 request : { get : requestStub } ,
107112 } ) ;
108113
114+ getInitialDetailsStub . returns ( Promise . resolve ( { } ) ) ;
109115 validateBstackJsonStub . returns ( Promise . resolve ( bsConfig ) ) ;
110116
111117 return info ( args , rawArgs )
112118 . then ( function ( _bsConfig ) {
113119 sinon . assert . calledOnce ( requestStub ) ;
114120 sinon . assert . calledOnce ( getUserAgentStub ) ;
115121 sinon . assert . calledOnce ( getConfigPathStub ) ;
116- sinon . assert . calledOnceWithExactly ( sendUsageReportStub , bsConfig , args , message , messageType , errorCode , null , rawArgs ) ;
122+ sinon . assert . calledOnce ( getInitialDetailsStub ) ;
123+ sinon . assert . calledOnceWithExactly ( sendUsageReportStub , bsConfig , args , message , messageType , errorCode , { } , rawArgs ) ;
117124 } )
118125 . catch ( ( error ) => {
119126 chai . assert . isNotOk ( error , "Promise error" ) ;
@@ -126,6 +133,7 @@ describe("buildInfo", () => {
126133 sandbox = sinon . createSandbox ( ) ;
127134 setUsernameStub = sandbox . stub ( ) ;
128135 setAccessKeyStub = sandbox . stub ( ) ;
136+ getInitialDetailsStub = sandbox . stub ( ) ;
129137 validateBstackJsonStub = sandbox . stub ( ) ;
130138 getConfigPathStub = sandbox . stub ( ) ;
131139 setUsageReportingFlagStub = sandbox . stub ( ) . returns ( undefined ) ;
@@ -156,6 +164,7 @@ describe("buildInfo", () => {
156164 '../helpers/utils' : {
157165 setUsername : setUsernameStub ,
158166 setAccessKey : setAccessKeyStub ,
167+ getInitialDetails : getInitialDetailsStub ,
159168 validateBstackJson : validateBstackJsonStub ,
160169 getErrorCodeFromErr : getErrorCodeFromErrStub ,
161170 sendUsageReport : sendUsageReportStub ,
@@ -170,13 +179,15 @@ describe("buildInfo", () => {
170179 } ) ;
171180
172181 validateBstackJsonStub . returns ( Promise . resolve ( bsConfig ) ) ;
182+ getInitialDetailsStub . returns ( Promise . resolve ( { } ) ) ;
173183
174184 return info ( args , rawArgs )
175185 . then ( function ( _bsConfig ) {
176186 sinon . assert . calledOnce ( requestStub ) ;
177187 sinon . assert . calledOnce ( getUserAgentStub ) ;
178188 sinon . assert . calledOnce ( getConfigPathStub ) ;
179- sinon . assert . calledOnceWithExactly ( sendUsageReportStub , bsConfig , args , message , messageType , errorCode , null , rawArgs ) ;
189+ sinon . assert . calledOnce ( getInitialDetailsStub ) ;
190+ sinon . assert . calledOnceWithExactly ( sendUsageReportStub , bsConfig , args , message , messageType , errorCode , { } , rawArgs ) ;
180191 } )
181192 . catch ( ( error ) => {
182193 chai . assert . isNotOk ( error , "Promise error" ) ;
@@ -201,6 +212,7 @@ describe("buildInfo", () => {
201212 '../helpers/utils' : {
202213 setUsername : setUsernameStub ,
203214 setAccessKey : setAccessKeyStub ,
215+ getInitialDetails : getInitialDetailsStub ,
204216 validateBstackJson : validateBstackJsonStub ,
205217 getErrorCodeFromErr : getErrorCodeFromErrStub ,
206218 sendUsageReport : sendUsageReportStub ,
@@ -215,13 +227,14 @@ describe("buildInfo", () => {
215227 } ) ;
216228
217229 validateBstackJsonStub . returns ( Promise . resolve ( bsConfig ) ) ;
218-
230+ getInitialDetailsStub . returns ( Promise . resolve ( { } ) ) ;
219231 return info ( args , rawArgs )
220232 . then ( function ( _bsConfig ) {
221233 sinon . assert . calledOnce ( requestStub ) ;
222234 sinon . assert . calledOnce ( getUserAgentStub ) ;
223235 sinon . assert . calledOnce ( getConfigPathStub ) ;
224- sinon . assert . calledOnceWithExactly ( sendUsageReportStub , bsConfig , args , message , messageType , errorCode , null , rawArgs ) ;
236+ sinon . assert . calledOnce ( getInitialDetailsStub ) ;
237+ sinon . assert . calledOnceWithExactly ( sendUsageReportStub , bsConfig , args , message , messageType , errorCode , { } , rawArgs ) ;
225238 } )
226239 . catch ( ( error ) => {
227240 chai . assert . isNotOk ( error , "Promise error" ) ;
@@ -241,6 +254,7 @@ describe("buildInfo", () => {
241254 '../helpers/utils' : {
242255 setUsername : setUsernameStub ,
243256 setAccessKey : setAccessKeyStub ,
257+ getInitialDetails : getInitialDetailsStub ,
244258 validateBstackJson : validateBstackJsonStub ,
245259 getErrorCodeFromErr : getErrorCodeFromErrStub ,
246260 sendUsageReport : sendUsageReportStub ,
@@ -255,13 +269,15 @@ describe("buildInfo", () => {
255269 } ) ;
256270
257271 validateBstackJsonStub . returns ( Promise . resolve ( bsConfig ) ) ;
272+ getInitialDetailsStub . returns ( Promise . resolve ( { } ) ) ;
258273
259274 return info ( args , rawArgs )
260275 . then ( function ( _bsConfig ) {
261276 sinon . assert . calledOnce ( requestStub ) ;
262277 sinon . assert . calledOnce ( getUserAgentStub ) ;
263278 sinon . assert . calledOnce ( getConfigPathStub ) ;
264- sinon . assert . calledOnceWithExactly ( sendUsageReportStub , bsConfig , args , message , messageType , errorCode , null , rawArgs ) ;
279+ sinon . assert . calledOnce ( getInitialDetailsStub ) ;
280+ sinon . assert . calledOnceWithExactly ( sendUsageReportStub , bsConfig , args , message , messageType , errorCode , { } , rawArgs ) ;
265281 } )
266282 . catch ( ( error ) => {
267283 chai . assert . isNotOk ( error , "Promise error" ) ;
@@ -276,6 +292,7 @@ describe("buildInfo", () => {
276292 sandbox = sinon . createSandbox ( ) ;
277293 setUsernameStub = sandbox . stub ( ) ;
278294 setAccessKeyStub = sandbox . stub ( ) ;
295+ getInitialDetailsStub = sandbox . stub ( ) ;
279296 validateBstackJsonStub = sandbox . stub ( ) ;
280297 getConfigPathStub = sandbox . stub ( ) ;
281298 setUsageReportingFlagStub = sandbox . stub ( ) . returns ( undefined ) ;
@@ -304,6 +321,7 @@ describe("buildInfo", () => {
304321 '../helpers/utils' : {
305322 setUsername : setUsernameStub ,
306323 setAccessKey : setAccessKeyStub ,
324+ getInitialDetails : getInitialDetailsStub ,
307325 validateBstackJson : validateBstackJsonStub ,
308326 getErrorCodeFromErr : getErrorCodeFromErrStub ,
309327 sendUsageReport : sendUsageReportStub ,
@@ -317,13 +335,15 @@ describe("buildInfo", () => {
317335 } ) ;
318336
319337 validateBstackJsonStub . returns ( Promise . resolve ( bsConfig ) ) ;
338+ getInitialDetailsStub . returns ( Promise . resolve ( { } ) ) ;
320339
321340 return info ( args , rawArgs )
322341 . then ( function ( _bsConfig ) {
323342 sinon . assert . calledOnce ( requestStub ) ;
324343 sinon . assert . calledOnce ( getUserAgentStub ) ;
325344 sinon . assert . calledOnce ( getConfigPathStub ) ;
326- sinon . assert . calledOnceWithExactly ( sendUsageReportStub , bsConfig , args , message , messageType , errorCode , null , rawArgs ) ;
345+ sinon . assert . calledOnce ( getInitialDetailsStub ) ;
346+ sinon . assert . calledOnceWithExactly ( sendUsageReportStub , bsConfig , args , message , messageType , errorCode , { } , rawArgs ) ;
327347 } ) . catch ( ( error ) => {
328348 chai . assert . isNotOk ( error , 'Promise error' ) ;
329349 } ) ;
@@ -337,6 +357,7 @@ describe("buildInfo", () => {
337357 sandbox = sinon . createSandbox ( ) ;
338358 setUsernameStub = sandbox . stub ( ) ;
339359 setAccessKeyStub = sandbox . stub ( ) ;
360+ getInitialDetailsStub = sandbox . stub ( ) ;
340361 getConfigPathStub = sandbox . stub ( ) ;
341362 validateBstackJsonStub = sandbox . stub ( ) ;
342363 setUsageReportingFlagStub = sandbox . stub ( ) . returns ( undefined ) ;
@@ -358,6 +379,7 @@ describe("buildInfo", () => {
358379 '../helpers/utils' : {
359380 setUsername : setUsernameStub ,
360381 setAccessKey : setAccessKeyStub ,
382+ getInitialDetails : getInitialDetailsStub ,
361383 validateBstackJson : validateBstackJsonStub ,
362384 getErrorCodeFromErr : getErrorCodeFromErrStub ,
363385 sendUsageReport : sendUsageReportStub ,
@@ -369,6 +391,7 @@ describe("buildInfo", () => {
369391 } ) ;
370392
371393 validateBstackJsonStub . returns ( Promise . reject ( { message : "reject error" } ) ) ;
394+ getInitialDetailsStub . returns ( Promise . reject ( { message : "reject error" } ) ) ;
372395
373396 return info ( args , rawArgs )
374397 . then ( function ( _bsConfig ) {
0 commit comments