mirror of
https://gitea.com/actions/cache.git
synced 2024-11-14 08:22:31 +08:00
ran code format
This commit is contained in:
parent
9fae644795
commit
c5862e209e
|
@ -244,7 +244,8 @@ test("isCacheFeatureAvailable for ac enabled", () => {
|
||||||
test("isCacheFeatureAvailable for ac disabled on GHES", () => {
|
test("isCacheFeatureAvailable for ac disabled on GHES", () => {
|
||||||
jest.spyOn(cache, "isFeatureAvailable").mockImplementation(() => false);
|
jest.spyOn(cache, "isFeatureAvailable").mockImplementation(() => false);
|
||||||
|
|
||||||
const message = "Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.";
|
const message =
|
||||||
|
"Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.";
|
||||||
const infoMock = jest.spyOn(core, "info");
|
const infoMock = jest.spyOn(core, "info");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -252,15 +253,15 @@ test("isCacheFeatureAvailable for ac disabled on GHES", () => {
|
||||||
expect(actionUtils.isCacheFeatureAvailable()).toBe(false);
|
expect(actionUtils.isCacheFeatureAvailable()).toBe(false);
|
||||||
expect(infoMock).toHaveBeenCalledWith(`[warning]${message}`);
|
expect(infoMock).toHaveBeenCalledWith(`[warning]${message}`);
|
||||||
} finally {
|
} finally {
|
||||||
delete process.env["GITHUB_SERVER_URL"];
|
delete process.env["GITHUB_SERVER_URL"];
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("isCacheFeatureAvailable for ac disabled on dotcom", () => {
|
test("isCacheFeatureAvailable for ac disabled on dotcom", () => {
|
||||||
jest.spyOn(cache, "isFeatureAvailable").mockImplementation(() => false);
|
jest.spyOn(cache, "isFeatureAvailable").mockImplementation(() => false);
|
||||||
|
|
||||||
const message = "An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.";
|
const message =
|
||||||
|
"An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.";
|
||||||
const infoMock = jest.spyOn(core, "info");
|
const infoMock = jest.spyOn(core, "info");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -268,7 +269,6 @@ test("isCacheFeatureAvailable for ac disabled on dotcom", () => {
|
||||||
expect(actionUtils.isCacheFeatureAvailable()).toBe(false);
|
expect(actionUtils.isCacheFeatureAvailable()).toBe(false);
|
||||||
expect(infoMock).toHaveBeenCalledWith(`[warning]${message}`);
|
expect(infoMock).toHaveBeenCalledWith(`[warning]${message}`);
|
||||||
} finally {
|
} finally {
|
||||||
delete process.env["GITHUB_SERVER_URL"];
|
delete process.env["GITHUB_SERVER_URL"];
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,7 +34,9 @@ beforeEach(() => {
|
||||||
process.env[RefKey] = "refs/heads/feature-branch";
|
process.env[RefKey] = "refs/heads/feature-branch";
|
||||||
|
|
||||||
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false);
|
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false);
|
||||||
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(() => true);
|
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(
|
||||||
|
() => true
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
@ -58,7 +60,9 @@ test("restore with invalid event outputs warning", async () => {
|
||||||
|
|
||||||
test("restore without AC available should no-op", async () => {
|
test("restore without AC available should no-op", async () => {
|
||||||
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false);
|
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false);
|
||||||
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(() => false);
|
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(
|
||||||
|
() => false
|
||||||
|
);
|
||||||
|
|
||||||
const restoreCacheMock = jest.spyOn(cache, "restoreCache");
|
const restoreCacheMock = jest.spyOn(cache, "restoreCache");
|
||||||
const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput");
|
const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput");
|
||||||
|
@ -72,7 +76,9 @@ test("restore without AC available should no-op", async () => {
|
||||||
|
|
||||||
test("restore on GHES without AC available should no-op", async () => {
|
test("restore on GHES without AC available should no-op", async () => {
|
||||||
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true);
|
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true);
|
||||||
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(() => false);
|
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(
|
||||||
|
() => false
|
||||||
|
);
|
||||||
|
|
||||||
const restoreCacheMock = jest.spyOn(cache, "restoreCache");
|
const restoreCacheMock = jest.spyOn(cache, "restoreCache");
|
||||||
const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput");
|
const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput");
|
||||||
|
|
|
@ -54,7 +54,9 @@ beforeEach(() => {
|
||||||
process.env[RefKey] = "refs/heads/feature-branch";
|
process.env[RefKey] = "refs/heads/feature-branch";
|
||||||
|
|
||||||
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false);
|
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false);
|
||||||
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(() => true);
|
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(
|
||||||
|
() => true
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
@ -103,7 +105,9 @@ test("save with no primary key in state outputs warning", async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("save without AC available should no=op", async () => {
|
test("save without AC available should no=op", async () => {
|
||||||
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(() => false);
|
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(
|
||||||
|
() => false
|
||||||
|
);
|
||||||
|
|
||||||
const saveCacheMock = jest.spyOn(cache, "saveCache");
|
const saveCacheMock = jest.spyOn(cache, "saveCache");
|
||||||
|
|
||||||
|
@ -114,7 +118,9 @@ test("save without AC available should no=op", async () => {
|
||||||
|
|
||||||
test("save on ghes without AC available should no=op", async () => {
|
test("save on ghes without AC available should no=op", async () => {
|
||||||
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true);
|
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true);
|
||||||
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(() => false);
|
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(
|
||||||
|
() => false
|
||||||
|
);
|
||||||
|
|
||||||
const saveCacheMock = jest.spyOn(cache, "saveCache");
|
const saveCacheMock = jest.spyOn(cache, "saveCache");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user