@@ -4,7 +4,8 @@ const chai = require("chai"),
4
4
sinon = require ( "sinon" ) ,
5
5
chaiAsPromised = require ( "chai-as-promised" ) ,
6
6
rewire = require ( "rewire" ) ,
7
- util = require ( "util" ) ;
7
+ util = require ( "util" ) ,
8
+ path = require ( 'path' ) ;
8
9
9
10
const Constants = require ( "../../../../bin/helpers/constants" ) ,
10
11
logger = require ( "../../../../bin/helpers/logger" ) . winstonLogger ,
@@ -44,7 +45,7 @@ describe("init", () => {
44
45
$0 : "browserstack-cypress" ,
45
46
} ;
46
47
47
- assert ( get_path ( args ) , '/sample-path/filename.json' ) ;
48
+ expect ( get_path ( args ) ) . to . be . eql ( '/sample-path/filename.json' ) ;
48
49
} ) ;
49
50
50
51
it ( "filename passed, -path not passed" , ( ) => {
@@ -55,7 +56,15 @@ describe("init", () => {
55
56
$0 : "browserstack-cypress" ,
56
57
} ;
57
58
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' ) ;
59
68
} ) ;
60
69
61
70
it ( "filepath passed, -path passed" , ( ) => {
@@ -84,7 +93,7 @@ describe("init", () => {
84
93
$0 : "browserstack-cypress" ,
85
94
} ;
86
95
87
- assert ( get_path ( args ) , '/sample-path/browserstack.json' ) ;
96
+ expect ( get_path ( args ) ) . to . be . eql ( '/sample-path/browserstack.json' ) ;
88
97
} ) ;
89
98
90
99
it ( "filename not passed, -path not passed" , ( ) => {
@@ -95,7 +104,7 @@ describe("init", () => {
95
104
$0 : "browserstack-cypress" ,
96
105
} ;
97
106
98
- assert ( get_path ( args ) , 'browserstack.json' ) ;
107
+ expect ( get_path ( args ) ) . to . be . eql ( path . join ( process . cwd ( ) , 'browserstack.json' ) ) ;
99
108
} ) ;
100
109
} ) ;
101
110
0 commit comments