@@ -4,9 +4,13 @@ const path = require("path");
4
4
const ui5Cli = require ( "../../../" ) ;
5
5
const init = ui5Cli . init ;
6
6
7
+ function getFixturePath ( fixtureName ) {
8
+ return path . join ( __dirname , ".." , ".." , "fixtures" , "init" , fixtureName ) ;
9
+ }
10
+
7
11
test ( "Init for application" , async ( t ) => {
8
12
const projectConfig = await init ( {
9
- cwd : path . join ( __dirname , ".." , ".." , "fixtures" , "init- application")
13
+ cwd : getFixturePath ( " application")
10
14
} ) ;
11
15
12
16
t . deepEqual ( projectConfig , {
@@ -20,7 +24,7 @@ test("Init for application", async (t) => {
20
24
21
25
test ( "Init for library" , async ( t ) => {
22
26
const projectConfig = await init ( {
23
- cwd : path . join ( __dirname , ".." , ".." , "fixtures" , "init- library")
27
+ cwd : getFixturePath ( " library")
24
28
} ) ;
25
29
26
30
t . deepEqual ( projectConfig , {
@@ -34,7 +38,7 @@ test("Init for library", async (t) => {
34
38
35
39
test ( "Init for invalid project (Found 'webapp' and 'src' folders)" , async ( t ) => {
36
40
await t . throws ( init ( {
37
- cwd : path . join ( __dirname , ".." , ".." , "fixtures" , "init- invalid-webapp-src")
41
+ cwd : getFixturePath ( " invalid-webapp-src")
38
42
} ) ,
39
43
"Could not detect project type: Found 'webapp' and 'src' folders.\n" +
40
44
"Applications should only have a 'webapp' folder.\n" +
@@ -43,7 +47,7 @@ test("Init for invalid project (Found 'webapp' and 'src' folders)", async (t) =>
43
47
44
48
test ( "Init for invalid project (No package.json)" , async ( t ) => {
45
49
await t . throws ( init ( {
46
- cwd : path . join ( __dirname , ".." , ".." , "fixtures" , "init- invalid-no-package-json")
50
+ cwd : getFixturePath ( " invalid-no-package-json")
47
51
} ) ,
48
52
"Initialization not possible: Missing package.json file" ) ;
49
53
} ) ;
0 commit comments