@@ -4,7 +4,8 @@ const chai = require("chai"),
44 sinon = require ( "sinon" ) ,
55 chaiAsPromised = require ( "chai-as-promised" ) ,
66 rewire = require ( "rewire" ) ,
7- util = require ( "util" ) ;
7+ util = require ( "util" ) ,
8+ path = require ( 'path' ) ;
89
910const Constants = require ( "../../../../bin/helpers/constants" ) ,
1011 logger = require ( "../../../../bin/helpers/logger" ) . winstonLogger ,
@@ -44,7 +45,7 @@ describe("init", () => {
4445 $0 : "browserstack-cypress" ,
4546 } ;
4647
47- assert ( get_path ( args ) , '/sample-path/filename.json' ) ;
48+ expect ( get_path ( args ) ) . to . be . eql ( '/sample-path/filename.json' ) ;
4849 } ) ;
4950
5051 it ( "filename passed, -path not passed" , ( ) => {
@@ -55,7 +56,15 @@ describe("init", () => {
5556 $0 : "browserstack-cypress" ,
5657 } ;
5758
58- assert ( get_path ( args ) , 'filename.json' ) ;
59+ let args2 = {
60+ _ : [ "init" , "~/filename.json" ] ,
61+ p : false ,
62+ path : false ,
63+ $0 : "browserstack-cypress" ,
64+ } ;
65+
66+ expect ( get_path ( args ) ) . to . be . eql ( path . join ( process . cwd ( ) , 'filename.json' ) ) ;
67+ expect ( get_path ( args2 ) ) . to . be . eql ( '~/filename.json' ) ;
5968 } ) ;
6069
6170 it ( "filepath passed, -path passed" , ( ) => {
@@ -84,7 +93,7 @@ describe("init", () => {
8493 $0 : "browserstack-cypress" ,
8594 } ;
8695
87- assert ( get_path ( args ) , '/sample-path/browserstack.json' ) ;
96+ expect ( get_path ( args ) ) . to . be . eql ( '/sample-path/browserstack.json' ) ;
8897 } ) ;
8998
9099 it ( "filename not passed, -path not passed" , ( ) => {
@@ -95,7 +104,7 @@ describe("init", () => {
95104 $0 : "browserstack-cypress" ,
96105 } ;
97106
98- assert ( get_path ( args ) , 'browserstack.json' ) ;
107+ expect ( get_path ( args ) ) . to . be . eql ( path . join ( process . cwd ( ) , 'browserstack.json' ) ) ;
99108 } ) ;
100109 } ) ;
101110
0 commit comments