@@ -79,64 +79,12 @@ describe('GitReleaseManagerTool', () => {
79
79
expect ( tool . settingsProvider ) . toBeDefined ( )
80
80
} )
81
81
82
- describe ( 'getRepoDir' , ( ) => {
83
- it ( 'should return correct repo dir for empty target path, takes build agent sourceDir' , async ( ) => {
84
- const buildAgent = {
85
- sourceDir : 'workdir'
86
- } as IBuildAgent
87
- tool = new TestGitReleaseManagerTool ( buildAgent )
88
- const repoDir = await tool . getRepoDir ( {
89
- targetDirectory : ''
90
- } as CommonSettings )
91
- expect ( repoDir ) . toBe ( 'workdir' )
92
- } )
93
-
94
- it ( 'should return correct repo dir for empty target path, takes default' , async ( ) => {
95
- const buildAgent = {
96
- sourceDir : ''
97
- } as IBuildAgent
98
- tool = new TestGitReleaseManagerTool ( buildAgent )
99
- const repoDir = await tool . getRepoDir ( {
100
- targetDirectory : ''
101
- } as CommonSettings )
102
- expect ( repoDir ) . toBe ( '.' )
103
- } )
104
-
105
- it ( 'should return correct repo dir for existing target path' , async ( ) => {
106
- const buildAgent = {
107
- async directoryExists ( _file : string ) : Promise < boolean > {
108
- return Promise . resolve ( true )
109
- }
110
- } as IBuildAgent
111
- tool = new TestGitReleaseManagerTool ( buildAgent )
112
- const repoDir = await tool . getRepoDir ( {
113
- targetDirectory : 'targetDir'
114
- } as CommonSettings )
115
- expect ( repoDir ) . toBe ( 'targetDir' )
116
- } )
117
-
118
- it ( 'should throw error for non-existing target path' , async ( ) => {
119
- const wrongDir = 'wrongdir'
120
- const buildAgent = {
121
- async directoryExists ( _file : string ) : Promise < boolean > {
122
- return Promise . resolve ( false )
123
- }
124
- } as IBuildAgent
125
- tool = new TestGitReleaseManagerTool ( buildAgent )
126
- await expect (
127
- tool . getRepoDir ( {
128
- targetDirectory : wrongDir
129
- } as CommonSettings )
130
- ) . rejects . toThrowError ( `Directory not found at ${ wrongDir } ` )
131
- } )
132
- } )
133
-
134
82
describe ( 'getArguments' , ( ) => {
135
83
const commonSettings = {
136
84
owner : 'owner' ,
137
85
repository : 'repo' ,
138
86
token : 'token' ,
139
- targetDirectory : 'targetDirectory' ,
87
+ targetDirectory : '/ targetDirectory' ,
140
88
logFilePath : './logFilePath'
141
89
} as CommonSettings
142
90
@@ -171,28 +119,11 @@ describe('GitReleaseManagerTool', () => {
171
119
'--token' ,
172
120
'token' ,
173
121
'--targetDirectory' ,
174
- ' targetDirectory',
122
+ path . normalize ( '/ targetDirectory') ,
175
123
'--logFilePath' ,
176
124
'./logFilePath'
177
125
] )
178
126
} )
179
-
180
- it ( 'should throw error for non-existing target path' , async ( ) => {
181
- tool = new TestGitReleaseManagerTool ( {
182
- async directoryExists ( _file : string ) : Promise < boolean > {
183
- return Promise . resolve ( false )
184
- }
185
- } as IBuildAgent )
186
-
187
- const wrongDir = 'wrongdir'
188
-
189
- await expect (
190
- tool . getCommonArguments ( {
191
- ...commonSettings ,
192
- targetDirectory : wrongDir
193
- } as CommonSettings )
194
- ) . rejects . toThrowError ( `Directory not found at ${ wrongDir } ` )
195
- } )
196
127
} )
197
128
198
129
describe ( 'getCreateArguments' , ( ) => {
@@ -217,7 +148,7 @@ describe('GitReleaseManagerTool', () => {
217
148
'--token' ,
218
149
'token' ,
219
150
'--targetDirectory' ,
220
- ' targetDirectory',
151
+ path . normalize ( '/ targetDirectory') ,
221
152
'--logFilePath' ,
222
153
'./createLogFilePath' ,
223
154
'--milestone' ,
@@ -230,7 +161,7 @@ describe('GitReleaseManagerTool', () => {
230
161
'inputFilePath' ,
231
162
'--pre' ,
232
163
'--assets' ,
233
- `${ path . join ( 'targetDirectory' , 'asset1' ) } ,${ path . join ( 'targetDirectory' , 'asset2' ) } `
164
+ `${ path . join ( '/ targetDirectory' , 'asset1' ) } ,${ path . join ( '/ targetDirectory' , 'asset2' ) } `
234
165
] )
235
166
} )
236
167
} )
@@ -251,7 +182,7 @@ describe('GitReleaseManagerTool', () => {
251
182
'--token' ,
252
183
'token' ,
253
184
'--targetDirectory' ,
254
- ' targetDirectory',
185
+ path . normalize ( '/ targetDirectory') ,
255
186
'--logFilePath' ,
256
187
'./logFilePath' ,
257
188
'--milestone' ,
@@ -276,7 +207,7 @@ describe('GitReleaseManagerTool', () => {
276
207
'--token' ,
277
208
'token' ,
278
209
'--targetDirectory' ,
279
- ' targetDirectory',
210
+ path . normalize ( '/ targetDirectory') ,
280
211
'--logFilePath' ,
281
212
'./logFilePath' ,
282
213
'--milestone' ,
@@ -301,7 +232,7 @@ describe('GitReleaseManagerTool', () => {
301
232
'--token' ,
302
233
'token' ,
303
234
'--targetDirectory' ,
304
- ' targetDirectory',
235
+ path . normalize ( '/ targetDirectory') ,
305
236
'--logFilePath' ,
306
237
'./logFilePath' ,
307
238
'--milestone' ,
@@ -326,7 +257,7 @@ describe('GitReleaseManagerTool', () => {
326
257
'--token' ,
327
258
'token' ,
328
259
'--targetDirectory' ,
329
- ' targetDirectory',
260
+ path . normalize ( '/ targetDirectory') ,
330
261
'--logFilePath' ,
331
262
'./logFilePath' ,
332
263
'--tagName' ,
@@ -352,13 +283,13 @@ describe('GitReleaseManagerTool', () => {
352
283
'--token' ,
353
284
'token' ,
354
285
'--targetDirectory' ,
355
- ' targetDirectory',
286
+ path . normalize ( '/ targetDirectory') ,
356
287
'--logFilePath' ,
357
288
'./logFilePath' ,
358
289
'--tagName' ,
359
290
'milestone' ,
360
291
'--assets' ,
361
- `${ path . join ( 'targetDirectory' , 'asset1' ) } ,${ path . join ( 'targetDirectory' , 'asset2' ) } `
292
+ `${ path . join ( '/ targetDirectory' , 'asset1' ) } ,${ path . join ( '/ targetDirectory' , 'asset2' ) } `
362
293
] )
363
294
} )
364
295
} )
0 commit comments