mirror of
https://code.forgejo.org/actions/cache.git
synced 2024-12-02 03:11:01 -05:00
fix: fix cache-hit value when cache not found
This commit is contained in:
parent
0865c47f36
commit
7f5799b6ac
2 changed files with 9 additions and 0 deletions
|
@ -205,6 +205,7 @@ test("restore with no cache found", async () => {
|
|||
key
|
||||
});
|
||||
|
||||
const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput");
|
||||
const infoMock = jest.spyOn(core, "info");
|
||||
const failedMock = jest.spyOn(core, "setFailed");
|
||||
const stateMock = jest.spyOn(core, "saveState");
|
||||
|
@ -216,6 +217,9 @@ test("restore with no cache found", async () => {
|
|||
|
||||
await run();
|
||||
|
||||
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
|
||||
expect(setCacheHitOutputMock).toHaveBeenCalledWith(false);
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith([path], key, []);
|
||||
|
||||
|
@ -237,6 +241,7 @@ test("restore with restore keys and no cache found", async () => {
|
|||
restoreKeys: [restoreKey]
|
||||
});
|
||||
|
||||
const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput");
|
||||
const infoMock = jest.spyOn(core, "info");
|
||||
const failedMock = jest.spyOn(core, "setFailed");
|
||||
const stateMock = jest.spyOn(core, "saveState");
|
||||
|
@ -248,6 +253,9 @@ test("restore with restore keys and no cache found", async () => {
|
|||
|
||||
await run();
|
||||
|
||||
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
|
||||
expect(setCacheHitOutputMock).toHaveBeenCalledWith(false);
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
|
||||
expect(restoreCacheMock).toHaveBeenCalledWith([path], key, [restoreKey]);
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ async function run(): Promise<void> {
|
|||
].join(", ")}`
|
||||
);
|
||||
|
||||
utils.setCacheHitOutput(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue