mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-20 15:53:59 +08:00
No-op on GHES
This commit is contained in:
parent
eed9cfe64d
commit
4d604c6cce
5 changed files with 60 additions and 0 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue