@@ -2,7 +2,7 @@ import * as cache from "@actions/cache"; |
2 | 2 | import * as core from "@actions/core"; |
3 | 3 |
|
4 | 4 | import { Events, Inputs, RefKey } from "../src/constants"; |
5 | | -import run from "../src/saveImpl"; |
| 5 | +import { saveImpl } from "../src/saveImpl"; |
6 | 6 | import { StateProvider } from "../src/stateProvider"; |
7 | 7 | import * as actionUtils from "../src/utils/actionUtils"; |
8 | 8 | import * as testUtils from "../src/utils/testUtils"; |
@@ -77,7 +77,7 @@ test("save with invalid event outputs warning", async () => { |
77 | 77 | const invalidEvent = "commit_comment"; |
78 | 78 | process.env[Events.Key] = invalidEvent; |
79 | 79 | delete process.env[RefKey]; |
80 | | - await run(new StateProvider()); |
| 80 | + await saveImpl(new StateProvider()); |
81 | 81 | expect(logWarningMock).toHaveBeenCalledWith( |
82 | 82 | `Event Validation Error: The event type ${invalidEvent} is not supported because it's not tied to a branch or tag ref.` |
83 | 83 | ); |
@@ -100,7 +100,7 @@ test("save with no primary key in state outputs warning", async () => { |
100 | 100 | }); |
101 | 101 | const saveCacheMock = jest.spyOn(cache, "saveCache"); |
102 | 102 |
|
103 | | - await run(new StateProvider()); |
| 103 | + await saveImpl(new StateProvider()); |
104 | 104 |
|
105 | 105 | expect(saveCacheMock).toHaveBeenCalledTimes(0); |
106 | 106 | expect(logWarningMock).toHaveBeenCalledWith(`Key is not specified.`); |
@@ -115,7 +115,7 @@ test("save without AC available should no-op", async () => { |
115 | 115 |
|
116 | 116 | const saveCacheMock = jest.spyOn(cache, "saveCache"); |
117 | 117 |
|
118 | | - await run(new StateProvider()); |
| 118 | + await saveImpl(new StateProvider()); |
119 | 119 |
|
120 | 120 | expect(saveCacheMock).toHaveBeenCalledTimes(0); |
121 | 121 | }); |
@@ -128,7 +128,7 @@ test("save on ghes without AC available should no-op", async () => { |
128 | 128 |
|
129 | 129 | const saveCacheMock = jest.spyOn(cache, "saveCache"); |
130 | 130 |
|
131 | | - await run(new StateProvider()); |
| 131 | + await saveImpl(new StateProvider()); |
132 | 132 |
|
133 | 133 | expect(saveCacheMock).toHaveBeenCalledTimes(0); |
134 | 134 | }); |
@@ -161,7 +161,7 @@ test("save on GHES with AC available", async () => { |
161 | 161 | return Promise.resolve(cacheId); |
162 | 162 | }); |
163 | 163 |
|
164 | | - await run(new StateProvider()); |
| 164 | + await saveImpl(new StateProvider()); |
165 | 165 |
|
166 | 166 | expect(saveCacheMock).toHaveBeenCalledTimes(1); |
167 | 167 | expect(saveCacheMock).toHaveBeenCalledWith( |
@@ -194,7 +194,7 @@ test("save with exact match returns early", async () => { |
194 | 194 | }); |
195 | 195 | const saveCacheMock = jest.spyOn(cache, "saveCache"); |
196 | 196 |
|
197 | | - await run(new StateProvider()); |
| 197 | + await saveImpl(new StateProvider()); |
198 | 198 |
|
199 | 199 | expect(saveCacheMock).toHaveBeenCalledTimes(0); |
200 | 200 | expect(infoMock).toHaveBeenCalledWith( |
@@ -221,7 +221,7 @@ test("save with missing input outputs warning", async () => { |
221 | 221 | }); |
222 | 222 | const saveCacheMock = jest.spyOn(cache, "saveCache"); |
223 | 223 |
|
224 | | - await run(new StateProvider()); |
| 224 | + await saveImpl(new StateProvider()); |
225 | 225 |
|
226 | 226 | expect(saveCacheMock).toHaveBeenCalledTimes(0); |
227 | 227 | expect(logWarningMock).toHaveBeenCalledWith( |
@@ -259,7 +259,7 @@ test("save with large cache outputs warning", async () => { |
259 | 259 | ); |
260 | 260 | }); |
261 | 261 |
|
262 | | - await run(new StateProvider()); |
| 262 | + await saveImpl(new StateProvider()); |
263 | 263 |
|
264 | 264 | expect(saveCacheMock).toHaveBeenCalledTimes(1); |
265 | 265 | expect(saveCacheMock).toHaveBeenCalledWith( |
@@ -306,7 +306,7 @@ test("save with reserve cache failure outputs warning", async () => { |
306 | 306 | throw error; |
307 | 307 | }); |
308 | 308 |
|
309 | | - await run(new StateProvider()); |
| 309 | + await saveImpl(new StateProvider()); |
310 | 310 |
|
311 | 311 | expect(saveCacheMock).toHaveBeenCalledTimes(1); |
312 | 312 | expect(saveCacheMock).toHaveBeenCalledWith( |
@@ -349,7 +349,7 @@ test("save with server error outputs warning", async () => { |
349 | 349 | throw new Error("HTTP Error Occurred"); |
350 | 350 | }); |
351 | 351 |
|
352 | | - await run(new StateProvider()); |
| 352 | + await saveImpl(new StateProvider()); |
353 | 353 |
|
354 | 354 | expect(saveCacheMock).toHaveBeenCalledTimes(1); |
355 | 355 | expect(saveCacheMock).toHaveBeenCalledWith( |
@@ -392,7 +392,7 @@ test("save with valid inputs uploads a cache", async () => { |
392 | 392 | return Promise.resolve(cacheId); |
393 | 393 | }); |
394 | 394 |
|
395 | | - await run(new StateProvider()); |
| 395 | + await saveImpl(new StateProvider()); |
396 | 396 |
|
397 | 397 | expect(saveCacheMock).toHaveBeenCalledTimes(1); |
398 | 398 | expect(saveCacheMock).toHaveBeenCalledWith( |
|