@@ -2,7 +2,7 @@ import * as cache from "@actions/cache";
22import * as core from "@actions/core" ;
33
44import { Events , Inputs , RefKey } from "../src/constants" ;
5- import run from "../src/restoreImpl" ;
5+ import { restoreImpl } from "../src/restoreImpl" ;
66import { StateProvider } from "../src/stateProvider" ;
77import * as actionUtils from "../src/utils/actionUtils" ;
88import * as testUtils from "../src/utils/testUtils" ;
@@ -60,7 +60,7 @@ test("restore with invalid event outputs warning", async () => {
6060 const invalidEvent = "commit_comment" ;
6161 process . env [ Events . Key ] = invalidEvent ;
6262 delete process . env [ RefKey ] ;
63- await run ( new StateProvider ( ) ) ;
63+ await restoreImpl ( new StateProvider ( ) ) ;
6464 expect ( logWarningMock ) . toHaveBeenCalledWith (
6565 `Event Validation Error: The event type ${ invalidEvent } is not supported because it's not tied to a branch or tag ref.`
6666 ) ;
@@ -76,7 +76,7 @@ test("restore without AC available should no-op", async () => {
7676 const restoreCacheMock = jest . spyOn ( cache , "restoreCache" ) ;
7777 const setCacheHitOutputMock = jest . spyOn ( core , "setOutput" ) ;
7878
79- await run ( new StateProvider ( ) ) ;
79+ await restoreImpl ( new StateProvider ( ) ) ;
8080
8181 expect ( restoreCacheMock ) . toHaveBeenCalledTimes ( 0 ) ;
8282 expect ( setCacheHitOutputMock ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -92,7 +92,7 @@ test("restore on GHES without AC available should no-op", async () => {
9292 const restoreCacheMock = jest . spyOn ( cache , "restoreCache" ) ;
9393 const setCacheHitOutputMock = jest . spyOn ( core , "setOutput" ) ;
9494
95- await run ( new StateProvider ( ) ) ;
95+ await restoreImpl ( new StateProvider ( ) ) ;
9696
9797 expect ( restoreCacheMock ) . toHaveBeenCalledTimes ( 0 ) ;
9898 expect ( setCacheHitOutputMock ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -119,7 +119,7 @@ test("restore on GHES with AC available ", async () => {
119119 return Promise . resolve ( key ) ;
120120 } ) ;
121121
122- await run ( new StateProvider ( ) ) ;
122+ await restoreImpl ( new StateProvider ( ) ) ;
123123
124124 expect ( restoreCacheMock ) . toHaveBeenCalledTimes ( 1 ) ;
125125 expect ( restoreCacheMock ) . toHaveBeenCalledWith (
@@ -143,7 +143,7 @@ test("restore on GHES with AC available ", async () => {
143143test ( "restore with no path should fail" , async ( ) => {
144144 const failedMock = jest . spyOn ( core , "setFailed" ) ;
145145 const restoreCacheMock = jest . spyOn ( cache , "restoreCache" ) ;
146- await run ( new StateProvider ( ) ) ;
146+ await restoreImpl ( new StateProvider ( ) ) ;
147147 expect ( restoreCacheMock ) . toHaveBeenCalledTimes ( 0 ) ;
148148 // this input isn't necessary for restore b/c tarball contains entries relative to workspace
149149 expect ( failedMock ) . not . toHaveBeenCalledWith (
@@ -155,7 +155,7 @@ test("restore with no key", async () => {
155155 testUtils . setInput ( Inputs . Path , "node_modules" ) ;
156156 const failedMock = jest . spyOn ( core , "setFailed" ) ;
157157 const restoreCacheMock = jest . spyOn ( cache , "restoreCache" ) ;
158- await run ( new StateProvider ( ) ) ;
158+ await restoreImpl ( new StateProvider ( ) ) ;
159159 expect ( restoreCacheMock ) . toHaveBeenCalledTimes ( 0 ) ;
160160 expect ( failedMock ) . toHaveBeenCalledWith (
161161 "Input required and not supplied: key"
@@ -174,7 +174,7 @@ test("restore with too many keys should fail", async () => {
174174 } ) ;
175175 const failedMock = jest . spyOn ( core , "setFailed" ) ;
176176 const restoreCacheMock = jest . spyOn ( cache , "restoreCache" ) ;
177- await run ( new StateProvider ( ) ) ;
177+ await restoreImpl ( new StateProvider ( ) ) ;
178178 expect ( restoreCacheMock ) . toHaveBeenCalledTimes ( 1 ) ;
179179 expect ( restoreCacheMock ) . toHaveBeenCalledWith (
180180 [ path ] ,
@@ -200,7 +200,7 @@ test("restore with large key should fail", async () => {
200200 } ) ;
201201 const failedMock = jest . spyOn ( core , "setFailed" ) ;
202202 const restoreCacheMock = jest . spyOn ( cache , "restoreCache" ) ;
203- await run ( new StateProvider ( ) ) ;
203+ await restoreImpl ( new StateProvider ( ) ) ;
204204 expect ( restoreCacheMock ) . toHaveBeenCalledTimes ( 1 ) ;
205205 expect ( restoreCacheMock ) . toHaveBeenCalledWith (
206206 [ path ] ,
@@ -226,7 +226,7 @@ test("restore with invalid key should fail", async () => {
226226 } ) ;
227227 const failedMock = jest . spyOn ( core , "setFailed" ) ;
228228 const restoreCacheMock = jest . spyOn ( cache , "restoreCache" ) ;
229- await run ( new StateProvider ( ) ) ;
229+ await restoreImpl ( new StateProvider ( ) ) ;
230230 expect ( restoreCacheMock ) . toHaveBeenCalledTimes ( 1 ) ;
231231 expect ( restoreCacheMock ) . toHaveBeenCalledWith (
232232 [ path ] ,
@@ -260,7 +260,7 @@ test("restore with no cache found", async () => {
260260 return Promise . resolve ( undefined ) ;
261261 } ) ;
262262
263- await run ( new StateProvider ( ) ) ;
263+ await restoreImpl ( new StateProvider ( ) ) ;
264264
265265 expect ( restoreCacheMock ) . toHaveBeenCalledTimes ( 1 ) ;
266266 expect ( restoreCacheMock ) . toHaveBeenCalledWith (
@@ -301,7 +301,7 @@ test("restore with restore keys and no cache found", async () => {
301301 return Promise . resolve ( undefined ) ;
302302 } ) ;
303303
304- await run ( new StateProvider ( ) ) ;
304+ await restoreImpl ( new StateProvider ( ) ) ;
305305
306306 expect ( restoreCacheMock ) . toHaveBeenCalledTimes ( 1 ) ;
307307 expect ( restoreCacheMock ) . toHaveBeenCalledWith (
@@ -341,7 +341,7 @@ test("restore with cache found for key", async () => {
341341 return Promise . resolve ( key ) ;
342342 } ) ;
343343
344- await run ( new StateProvider ( ) ) ;
344+ await restoreImpl ( new StateProvider ( ) ) ;
345345
346346 expect ( restoreCacheMock ) . toHaveBeenCalledTimes ( 1 ) ;
347347 expect ( restoreCacheMock ) . toHaveBeenCalledWith (
@@ -383,7 +383,7 @@ test("restore with cache found for restore key", async () => {
383383 return Promise . resolve ( restoreKey ) ;
384384 } ) ;
385385
386- await run ( new StateProvider ( ) ) ;
386+ await restoreImpl ( new StateProvider ( ) ) ;
387387
388388 expect ( restoreCacheMock ) . toHaveBeenCalledTimes ( 1 ) ;
389389 expect ( restoreCacheMock ) . toHaveBeenCalledWith (
@@ -424,7 +424,7 @@ test("restore with lookup-only set", async () => {
424424 return Promise . resolve ( key ) ;
425425 } ) ;
426426
427- await run ( new StateProvider ( ) ) ;
427+ await restoreImpl ( new StateProvider ( ) ) ;
428428
429429 expect ( restoreCacheMock ) . toHaveBeenCalledTimes ( 1 ) ;
430430 expect ( restoreCacheMock ) . toHaveBeenCalledWith (
0 commit comments