No-op on GHES

This commit is contained in:
Dave Hadka 2020-09-29 09:58:32 -05:00
parent eed9cfe64d
commit 4d604c6cce
5 changed files with 60 additions and 0 deletions

View file

@ -53,6 +53,30 @@ test("restore with invalid event outputs warning", async () => {
expect(failedMock).toHaveBeenCalledTimes(0);
});
test("restore on GHES should no-op", async () => {
try {
process.env["GITHUB_SERVER_URL"] = "http://example.com";
const infoMock = jest.spyOn(core, "info");
const restoreCacheMock = jest.spyOn(cache, "restoreCache");
const setCacheHitOutputMock = jest.spyOn(
actionUtils,
"setCacheHitOutput"
);
await run();
expect(restoreCacheMock).toHaveBeenCalledTimes(0);
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
expect(setCacheHitOutputMock).toHaveBeenCalledWith(false);
expect(infoMock).toHaveBeenCalledWith(
"Cache action is not supported on GHES"
);
} finally {
process.env["GITHUB_SERVER_URL"] = undefined;
}
});
test("restore with no path should fail", async () => {
const failedMock = jest.spyOn(core, "setFailed");
const restoreCacheMock = jest.spyOn(cache, "restoreCache");