@@ -3,11 +3,13 @@ const path = require('path');
33
44const chai = require ( "chai" ) ,
55 expect = chai . expect ,
6+ sinon = require ( 'sinon' ) ,
67 chaiAsPromised = require ( "chai-as-promised" ) ;
78
89const utils = require ( '../../../../bin/helpers/utils' ) ,
910 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" ) ;
1113
1214chai . use ( chaiAsPromised ) ;
1315logger . transports [ "console.info" ] . silent = true ;
@@ -35,7 +37,7 @@ describe("utils", () => {
3537 expect ( utils . isParallelValid ( "1.2.2.2" ) ) . to . be . equal ( false ) ;
3638 expect ( utils . isParallelValid ( "1.456789" ) ) . to . be . equal ( false ) ;
3739 } ) ;
38-
40+
3941 it ( "should return false for a string which is not a number" , ( ) => {
4042 expect ( utils . isParallelValid ( "cypress" ) ) . to . be . equal ( false ) ;
4143 expect ( utils . isParallelValid ( "browserstack" ) ) . to . be . equal ( false ) ;
@@ -220,6 +222,18 @@ describe("utils", () => {
220222 let configPath = "../Relative/Path"
221223 expect ( utils . getConfigPath ( configPath ) ) . to . be . eq ( path . join ( process . cwd ( ) , configPath ) ) ;
222224 } ) ;
225+ } ) ;
223226
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+ } ) ;
224238 } ) ;
225239} ) ;
0 commit comments