mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-20 15:53:59 +08:00
Consume latest toolkit and fix dangling promise bug (#1217)
* Consume latest toolkit and fix dangling promise bug * Pass earlyExit parameter to run method so tests don't hang * Pass earlyExit parameter to run method so tests don't hang * Refactor restore files to have better patterns for testing * style
This commit is contained in:
parent
67b839edb6
commit
f7ebb81a3f
14 changed files with 922 additions and 239 deletions
|
@ -2,7 +2,7 @@ import * as cache from "@actions/cache";
|
|||
import * as core from "@actions/core";
|
||||
|
||||
import { Events, RefKey } from "../src/constants";
|
||||
import run from "../src/restoreOnly";
|
||||
import { restoreOnlyRun } from "../src/restoreImpl";
|
||||
import * as actionUtils from "../src/utils/actionUtils";
|
||||
import * as testUtils from "../src/utils/testUtils";
|
||||
|
||||
|
@ -72,7 +72,7 @@ test("restore with no cache found", async () => {
|
|||
return Promise.resolve(undefined);
|
||||
});
|
||||
|
||||
await run();
|
||||
await restoreOnlyRun();
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
|
@ -114,7 +114,7 @@ test("restore with restore keys and no cache found", async () => {
|
|||
return Promise.resolve(undefined);
|
||||
});
|
||||
|
||||
await run();
|
||||
await restoreOnlyRun();
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
|
@ -153,7 +153,7 @@ test("restore with cache found for key", async () => {
|
|||
return Promise.resolve(key);
|
||||
});
|
||||
|
||||
await run();
|
||||
await restoreOnlyRun();
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
|
@ -196,7 +196,7 @@ test("restore with cache found for restore key", async () => {
|
|||
return Promise.resolve(restoreKey);
|
||||
});
|
||||
|
||||
await run();
|
||||
await restoreOnlyRun();
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue