@@ -3,11 +3,13 @@ const path = require('path');
3
3
4
4
const chai = require ( "chai" ) ,
5
5
expect = chai . expect ,
6
+ sinon = require ( 'sinon' ) ,
6
7
chaiAsPromised = require ( "chai-as-promised" ) ;
7
8
8
9
const utils = require ( '../../../../bin/helpers/utils' ) ,
9
10
constant = require ( '../../../../bin/helpers/constants' ) ,
10
- logger = require ( '../../../../bin/helpers/logger' ) . winstonLogger ;
11
+ logger = require ( '../../../../bin/helpers/logger' ) . winstonLogger ,
12
+ testObjects = require ( "../../support/fixtures/testObjects" ) ;
11
13
12
14
chai . use ( chaiAsPromised ) ;
13
15
logger . transports [ "console.info" ] . silent = true ;
@@ -35,7 +37,7 @@ describe("utils", () => {
35
37
expect ( utils . isParallelValid ( "1.2.2.2" ) ) . to . be . equal ( false ) ;
36
38
expect ( utils . isParallelValid ( "1.456789" ) ) . to . be . equal ( false ) ;
37
39
} ) ;
38
-
40
+
39
41
it ( "should return false for a string which is not a number" , ( ) => {
40
42
expect ( utils . isParallelValid ( "cypress" ) ) . to . be . equal ( false ) ;
41
43
expect ( utils . isParallelValid ( "browserstack" ) ) . to . be . equal ( false ) ;
@@ -220,6 +222,18 @@ describe("utils", () => {
220
222
let configPath = "../Relative/Path"
221
223
expect ( utils . getConfigPath ( configPath ) ) . to . be . eq ( path . join ( process . cwd ( ) , configPath ) ) ;
222
224
} ) ;
225
+ } ) ;
223
226
227
+ describe ( "configCreated" , ( ) => {
228
+ let args = testObjects . initSampleArgs ;
229
+
230
+ it ( "should call sendUsageReport" , ( ) => {
231
+ sandbox = sinon . createSandbox ( ) ;
232
+ sendUsageReportStub = sandbox . stub ( utils , "sendUsageReport" ) . callsFake ( function ( ) {
233
+ return "end" ;
234
+ } ) ;
235
+ utils . configCreated ( args ) ;
236
+ sinon . assert . calledOnce ( sendUsageReportStub ) ;
237
+ } ) ;
224
238
} ) ;
225
239
} ) ;
0 commit comments