@@ -199,4 +199,76 @@ describe('config.ts', () => {
199199 / O n l y o n e o f ' p u l u m i - v e r s i o n ' o r ' p u l u m i - v e r s i o n - f i l e ' s h o u l d b e p r o v i d e d , g o t b o t h / ,
200200 ) ;
201201 } ) ;
202+
203+ it ( 'should use working-directory when work-dir is not provided' , async ( ) => {
204+ jest . mock ( '@actions/core' , ( ) => ( {
205+ getInput : jest . fn ( ( name : string ) => {
206+ switch ( name ) {
207+ case 'work-dir' :
208+ return '' ;
209+ case 'working-directory' :
210+ return '/custom/path' ;
211+ default :
212+ return defaultConfig [ name ] ;
213+ }
214+ } ) ,
215+ getBooleanInput : jest . fn ( ( name : string ) => {
216+ return defaultConfig [ name ] ;
217+ } ) ,
218+ getMultilineInput : jest . fn ( ( name : string ) => {
219+ return defaultConfig [ name ] ;
220+ } ) ,
221+ } ) ) ;
222+ const { makeConfig } = require ( '../config' ) ;
223+ const c = makeConfig ( ) ;
224+ expect ( c . workDir ) . toBe ( '/custom/path' ) ;
225+ } ) ;
226+
227+ it ( 'should use work-dir when working-directory is not provided' , async ( ) => {
228+ jest . mock ( '@actions/core' , ( ) => ( {
229+ getInput : jest . fn ( ( name : string ) => {
230+ switch ( name ) {
231+ case 'work-dir' :
232+ return '/custom/path' ;
233+ case 'working-directory' :
234+ return '' ;
235+ default :
236+ return defaultConfig [ name ] ;
237+ }
238+ } ) ,
239+ getBooleanInput : jest . fn ( ( name : string ) => {
240+ return defaultConfig [ name ] ;
241+ } ) ,
242+ getMultilineInput : jest . fn ( ( name : string ) => {
243+ return defaultConfig [ name ] ;
244+ } ) ,
245+ } ) ) ;
246+ const { makeConfig } = require ( '../config' ) ;
247+ const c = makeConfig ( ) ;
248+ expect ( c . workDir ) . toBe ( '/custom/path' ) ;
249+ } ) ;
250+
251+ it ( 'should prefer work-dir over working-directory when both are provided' , async ( ) => {
252+ jest . mock ( '@actions/core' , ( ) => ( {
253+ getInput : jest . fn ( ( name : string ) => {
254+ switch ( name ) {
255+ case 'work-dir' :
256+ return '/work/dir/path' ;
257+ case 'working-directory' :
258+ return '/working/directory/path' ;
259+ default :
260+ return defaultConfig [ name ] ;
261+ }
262+ } ) ,
263+ getBooleanInput : jest . fn ( ( name : string ) => {
264+ return defaultConfig [ name ] ;
265+ } ) ,
266+ getMultilineInput : jest . fn ( ( name : string ) => {
267+ return defaultConfig [ name ] ;
268+ } ) ,
269+ } ) ) ;
270+ const { makeConfig } = require ( '../config' ) ;
271+ const c = makeConfig ( ) ;
272+ expect ( c . workDir ) . toBe ( '/work/dir/path' ) ;
273+ } ) ;
202274} ) ;
0 commit comments