@@ -6,7 +6,7 @@ const ui5Fs = require("@ui5/fs");
6
6
const resourceFactory = ui5Fs . resourceFactory ;
7
7
8
8
test ( "test.js: dbg file creation" , ( t ) => {
9
- const sourceReader = resourceFactory . createAdapter ( {
9
+ const sourceAdapter = resourceFactory . createAdapter ( {
10
10
virBasePath : "/"
11
11
} ) ;
12
12
const content = "console.log('Hello World');" ;
@@ -16,15 +16,14 @@ test("test.js: dbg file creation", (t) => {
16
16
string : content
17
17
} ) ;
18
18
19
- const workspace = resourceFactory . createWorkspace ( { reader : sourceReader } ) ;
20
- return workspace . write ( resource ) . then ( ( ) => {
19
+ return sourceAdapter . write ( resource ) . then ( ( ) => {
21
20
return tasks . createDebugFiles ( {
22
- workspace : workspace ,
21
+ workspace : sourceAdapter ,
23
22
options : {
24
23
pattern : "/**/*.js"
25
24
}
26
25
} ) . then ( ( ) => {
27
- return workspace . byPath ( "/test-dbg.js" ) . then ( ( resource ) => {
26
+ return sourceAdapter . byPath ( "/test-dbg.js" ) . then ( ( resource ) => {
28
27
if ( ! resource ) {
29
28
t . fail ( "Could not find /test-dbg.js in target" ) ;
30
29
} else {
@@ -38,7 +37,7 @@ test("test.js: dbg file creation", (t) => {
38
37
} ) ;
39
38
40
39
test ( "test.view.js: dbg file creation" , ( t ) => {
41
- const sourceReader = resourceFactory . createAdapter ( {
40
+ const sourceAdapter = resourceFactory . createAdapter ( {
42
41
virBasePath : "/"
43
42
} ) ;
44
43
const content = "console.log('Hello World');" ;
@@ -48,15 +47,14 @@ test("test.view.js: dbg file creation", (t) => {
48
47
string : content
49
48
} ) ;
50
49
51
- const workspace = resourceFactory . createWorkspace ( { reader : sourceReader } ) ;
52
- return workspace . write ( resource ) . then ( ( ) => {
50
+ return sourceAdapter . write ( resource ) . then ( ( ) => {
53
51
return tasks . createDebugFiles ( {
54
- workspace : workspace ,
52
+ workspace : sourceAdapter ,
55
53
options : {
56
54
pattern : "/**/*.js"
57
55
}
58
56
} ) . then ( ( ) => {
59
- return workspace . byPath ( "/test-dbg.view.js" ) . then ( ( resource ) => {
57
+ return sourceAdapter . byPath ( "/test-dbg.view.js" ) . then ( ( resource ) => {
60
58
if ( ! resource ) {
61
59
t . fail ( "Could not find /test-dbg.view.js in target" ) ;
62
60
} else {
@@ -70,7 +68,7 @@ test("test.view.js: dbg file creation", (t) => {
70
68
} ) ;
71
69
72
70
test ( "test.controller.js: dbg file creation" , ( t ) => {
73
- const sourceReader = resourceFactory . createAdapter ( {
71
+ const sourceAdapter = resourceFactory . createAdapter ( {
74
72
virBasePath : "/"
75
73
} ) ;
76
74
const content = "console.log('Hello World');" ;
@@ -80,15 +78,14 @@ test("test.controller.js: dbg file creation", (t) => {
80
78
string : content
81
79
} ) ;
82
80
83
- const workspace = resourceFactory . createWorkspace ( { reader : sourceReader } ) ;
84
- return workspace . write ( resource ) . then ( ( ) => {
81
+ return sourceAdapter . write ( resource ) . then ( ( ) => {
85
82
return tasks . createDebugFiles ( {
86
- workspace : workspace ,
83
+ workspace : sourceAdapter ,
87
84
options : {
88
85
pattern : "/**/*.js"
89
86
}
90
87
} ) . then ( ( ) => {
91
- return workspace . byPath ( "/test-dbg.controller.js" ) . then ( ( resource ) => {
88
+ return sourceAdapter . byPath ( "/test-dbg.controller.js" ) . then ( ( resource ) => {
92
89
if ( ! resource ) {
93
90
t . fail ( "Could not find /test-dbg.controller.js in target" ) ;
94
91
} else {
@@ -102,7 +99,7 @@ test("test.controller.js: dbg file creation", (t) => {
102
99
} ) ;
103
100
104
101
test ( "test.fragment.js: dbg file creation" , ( t ) => {
105
- const sourceReader = resourceFactory . createAdapter ( {
102
+ const sourceAdapter = resourceFactory . createAdapter ( {
106
103
virBasePath : "/"
107
104
} ) ;
108
105
const content = "console.log('Hello World');" ;
@@ -112,15 +109,14 @@ test("test.fragment.js: dbg file creation", (t) => {
112
109
string : content
113
110
} ) ;
114
111
115
- const workspace = resourceFactory . createWorkspace ( { reader : sourceReader } ) ;
116
- return workspace . write ( resource ) . then ( ( ) => {
112
+ return sourceAdapter . write ( resource ) . then ( ( ) => {
117
113
return tasks . createDebugFiles ( {
118
- workspace : workspace ,
114
+ workspace : sourceAdapter ,
119
115
options : {
120
116
pattern : "/**/*.js"
121
117
}
122
118
} ) . then ( ( ) => {
123
- return workspace . byPath ( "/test-dbg.fragment.js" ) . then ( ( resource ) => {
119
+ return sourceAdapter . byPath ( "/test-dbg.fragment.js" ) . then ( ( resource ) => {
124
120
if ( ! resource ) {
125
121
t . fail ( "Could not find /test-dbg.fragment.js in target locator" ) ;
126
122
} else {
@@ -134,7 +130,7 @@ test("test.fragment.js: dbg file creation", (t) => {
134
130
} ) ;
135
131
136
132
test ( "test-dbg.js: dbg-dbg file creation" , ( t ) => {
137
- const sourceReader = resourceFactory . createAdapter ( {
133
+ const sourceAdapter = resourceFactory . createAdapter ( {
138
134
virBasePath : "/"
139
135
} ) ;
140
136
const content = "console.log('Hello World');" ;
@@ -144,15 +140,14 @@ test("test-dbg.js: dbg-dbg file creation", (t) => {
144
140
string : content
145
141
} ) ;
146
142
147
- const workspace = resourceFactory . createWorkspace ( { reader : sourceReader } ) ;
148
- return workspace . write ( resource ) . then ( ( ) => {
143
+ return sourceAdapter . write ( resource ) . then ( ( ) => {
149
144
return tasks . createDebugFiles ( {
150
- workspace : workspace ,
145
+ workspace : sourceAdapter ,
151
146
options : {
152
147
pattern : "/**/*.js"
153
148
}
154
149
} ) . then ( ( ) => {
155
- return workspace . byPath ( "/test-dbg-dbg.js" ) . then ( ( resource ) => {
150
+ return sourceAdapter . byPath ( "/test-dbg-dbg.js" ) . then ( ( resource ) => {
156
151
if ( ! resource ) {
157
152
t . fail ( "Could not find /test-dbg-dbg.js in target locator" ) ;
158
153
} else {
@@ -166,7 +161,7 @@ test("test-dbg.js: dbg-dbg file creation", (t) => {
166
161
} ) ;
167
162
168
163
test ( "test.xml: *no* dbg file creation" , ( t ) => {
169
- const sourceReader = resourceFactory . createAdapter ( {
164
+ const sourceAdapter = resourceFactory . createAdapter ( {
170
165
virBasePath : "/"
171
166
} ) ;
172
167
const content = "<xml></xml>" ;
@@ -176,15 +171,14 @@ test("test.xml: *no* dbg file creation", (t) => {
176
171
string : content
177
172
} ) ;
178
173
179
- const workspace = resourceFactory . createWorkspace ( { reader : sourceReader } ) ;
180
- return workspace . write ( resource ) . then ( ( ) => {
174
+ return sourceAdapter . write ( resource ) . then ( ( ) => {
181
175
return tasks . createDebugFiles ( {
182
- workspace : workspace ,
176
+ workspace : sourceAdapter ,
183
177
options : {
184
178
pattern : "/**/*.js"
185
179
}
186
180
} ) . then ( ( ) => {
187
- return workspace . byPath ( "/test-dbg.xml" ) . then ( ( resource ) => {
181
+ return sourceAdapter . byPath ( "/test-dbg.xml" ) . then ( ( resource ) => {
188
182
if ( ! resource ) {
189
183
t . pass ( "Could not find /test-dbg.xml in target locator as it is not a JavaScript file" ) ;
190
184
} else {
@@ -196,7 +190,7 @@ test("test.xml: *no* dbg file creation", (t) => {
196
190
} ) ;
197
191
198
192
test ( "test1.js, test2.js: dbg file creation" , ( t ) => {
199
- const sourceReader = resourceFactory . createAdapter ( {
193
+ const sourceAdapter = resourceFactory . createAdapter ( {
200
194
virBasePath : "/"
201
195
} ) ;
202
196
const content = "console.log('Hello World');" ;
@@ -212,19 +206,18 @@ test("test1.js, test2.js: dbg file creation", (t) => {
212
206
} )
213
207
] ;
214
208
215
- const workspace = resourceFactory . createWorkspace ( { reader : sourceReader } ) ;
216
209
return Promise . all ( resources . map ( ( resource ) => {
217
- return workspace . write ( resource ) ;
210
+ return sourceAdapter . write ( resource ) ;
218
211
} ) ) . then ( ( ) => {
219
212
return tasks . createDebugFiles ( {
220
- workspace : workspace ,
213
+ workspace : sourceAdapter ,
221
214
options : {
222
215
pattern : "/**/*.js"
223
216
}
224
217
} ) . then ( ( ) => {
225
218
return Promise . all ( [
226
- workspace . byPath ( "/test1-dbg.js" ) ,
227
- workspace . byPath ( "/test2-dbg.js" )
219
+ sourceAdapter . byPath ( "/test1-dbg.js" ) ,
220
+ sourceAdapter . byPath ( "/test2-dbg.js" )
228
221
] ) . then ( ( resources ) => {
229
222
if ( ! resources || ! resources [ 0 ] || ! resources [ 1 ] ) {
230
223
t . fail ( "Could not find /test1-dbg.js and/or /test2-dbg.js in target locator" ) ;
0 commit comments