@@ -13,17 +13,33 @@ beforeEach(() => {
1313} ) ;
1414
1515describe ( 'getDirInput' , ( ) => {
16- it ( 'can return input value when $SELF_CACHED_DIR is not set' , ( ) => {
16+ it ( 'can return input value when only $SELF_CACHED_DIR is set' , ( ) => {
17+ vi . stubEnv ( 'SELF_CACHED_DIR' , 'foo' ) ;
18+ vi . stubEnv ( 'RUNNER_TOOL_CACHE' , undefined ) ;
19+ expect ( getDirInput ( 'baz' ) ) . toBe ( 'baz' ) ;
20+ expect ( getDirInput ( undefined ) ) . toBe ( 'foo' ) ;
21+ } ) ;
22+
23+ it ( 'can return input value when only $RUNNER_TOOL_CACHE is set' , ( ) => {
1724 vi . stubEnv ( 'SELF_CACHED_DIR' , undefined ) ;
18- expect ( getDirInput ( 'foo' ) ) . toBe ( 'foo' ) ;
19- expect ( getDirInput ( undefined ) ) . toBe ( path . join ( os . homedir ( ) , '.self-cached' ) ) ;
25+ vi . stubEnv ( 'RUNNER_TOOL_CACHE' , 'foo' ) ;
26+ expect ( getDirInput ( 'baz' ) ) . toBe ( 'baz' ) ;
27+ expect ( getDirInput ( undefined ) ) . toBe ( 'foo' ) ;
2028 } ) ;
2129
22- it ( 'can return input value when $SELF_CACHED_DIR is set' , ( ) => {
30+ it ( 'can return input value when both $SELF_CACHED_DIR and $RUNNER_TOOL_CACHE are set' , ( ) => {
2331 vi . stubEnv ( 'SELF_CACHED_DIR' , 'foo' ) ;
24- expect ( getDirInput ( 'bar' ) ) . toBe ( 'bar' ) ;
32+ vi . stubEnv ( 'RUNNER_TOOL_CACHE' , 'bar' ) ;
33+ expect ( getDirInput ( 'baz' ) ) . toBe ( 'baz' ) ;
2534 expect ( getDirInput ( undefined ) ) . toBe ( 'foo' ) ;
2635 } ) ;
36+
37+ it ( "can't return input value when neither $SELF_CACHED_DIR or $RUNNER_TOOL_CACHE are not set" , ( ) => {
38+ vi . stubEnv ( 'SELF_CACHED_DIR' , undefined ) ;
39+ vi . stubEnv ( 'RUNNER_TOOL_CACHE' , undefined ) ;
40+ expect ( getDirInput ( 'baz' ) ) . toBe ( 'baz' ) ;
41+ expect ( getDirInput ( undefined ) ) . toBe ( undefined ) ;
42+ } ) ;
2743} ) ;
2844
2945describe ( 'getLocalPath' , ( ) => {
0 commit comments