mirror of
https://code.forgejo.org/actions/cache.git
synced 2024-11-27 14:39:16 +01:00
Add test case for process exit
Co-authored-by: Bethany <bethanyj28@users.noreply.github.com>
This commit is contained in:
parent
3884cace14
commit
8a55f839aa
1 changed files with 16 additions and 0 deletions
|
@ -449,3 +449,19 @@ test("restore with lookup-only set", async () => {
|
|||
);
|
||||
expect(failedMock).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
test("restore failure with earlyExit should call process exit", async () => {
|
||||
testUtils.setInput(Inputs.Path, "node_modules");
|
||||
const failedMock = jest.spyOn(core, "setFailed");
|
||||
const restoreCacheMock = jest.spyOn(cache, "restoreCache");
|
||||
const processExitMock = jest.spyOn(process, "exit").mockImplementation();
|
||||
|
||||
// call restoreImpl with `earlyExit` set to true
|
||||
await restoreImpl(new StateProvider(), true);
|
||||
|
||||
expect(restoreCacheMock).toHaveBeenCalledTimes(0);
|
||||
expect(failedMock).toHaveBeenCalledWith(
|
||||
"Input required and not supplied: key"
|
||||
);
|
||||
expect(processExitMock).toHaveBeenCalledWith(1);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue