3
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2025-04-30 23:25:51 +00:00

Add tests for cache refreshing.

This commit is contained in:
Gregorio Litenstein 2023-04-07 21:38:17 -04:00
parent 39c1f23499
commit 34ae092a8c
No known key found for this signature in database
GPG key ID: 4EB52A1A9CE2C63F
15 changed files with 246709 additions and 151139 deletions

View file

@ -1,5 +1,6 @@
import * as cache from "@actions/cache";
import * as core from "@actions/core";
import nock from "nock";
import { Events, RefKey } from "../src/constants";
import { restoreOnlyRun } from "../src/restoreImpl";
@ -9,6 +10,7 @@ import * as testUtils from "../src/utils/testUtils";
jest.mock("../src/utils/actionUtils");
beforeAll(() => {
nock.disableNetConnect();
jest.spyOn(actionUtils, "isExactKeyMatch").mockImplementation(
(key, cacheResult) => {
const actualUtils = jest.requireActual("../src/utils/actionUtils");
@ -54,6 +56,10 @@ afterEach(() => {
delete process.env[RefKey];
});
afterAll(() => {
nock.enableNetConnect();
});
test("restore with no cache found", async () => {
const path = "node_modules";
const key = "node-test";