Skip to content

Commit

Permalink
ran code format
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubham Tiwari committed Mar 28, 2022
1 parent 9fae644 commit c5862e2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
12 changes: 6 additions & 6 deletions __tests__/actionUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,31 +244,31 @@ test("isCacheFeatureAvailable for ac enabled", () => {
test("isCacheFeatureAvailable for ac disabled on GHES", () => {
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");

try {
process.env["GITHUB_SERVER_URL"] = "http://example.com";
expect(actionUtils.isCacheFeatureAvailable()).toBe(false);
expect(infoMock).toHaveBeenCalledWith(`[warning]${message}`);
} finally {
delete process.env["GITHUB_SERVER_URL"];
delete process.env["GITHUB_SERVER_URL"];
}

});

test("isCacheFeatureAvailable for ac disabled on dotcom", () => {
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");

try {
process.env["GITHUB_SERVER_URL"] = "http://github.com";
expect(actionUtils.isCacheFeatureAvailable()).toBe(false);
expect(infoMock).toHaveBeenCalledWith(`[warning]${message}`);
} finally {
delete process.env["GITHUB_SERVER_URL"];
delete process.env["GITHUB_SERVER_URL"];
}

});
12 changes: 9 additions & 3 deletions __tests__/restore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ beforeEach(() => {
process.env[RefKey] = "refs/heads/feature-branch";

jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false);
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(() => true);
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(
() => true
);
});

afterEach(() => {
Expand All @@ -58,7 +60,9 @@ test("restore with invalid event outputs warning", async () => {

test("restore without AC available should no-op", async () => {
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 setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput");
Expand All @@ -72,7 +76,9 @@ test("restore 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, "isCacheFeatureAvailable").mockImplementation(() => false);
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(
() => false
);

const restoreCacheMock = jest.spyOn(cache, "restoreCache");
const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput");
Expand Down
14 changes: 10 additions & 4 deletions __tests__/save.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ beforeEach(() => {
process.env[RefKey] = "refs/heads/feature-branch";

jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false);
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(() => true);
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(
() => true
);
});

afterEach(() => {
Expand Down Expand Up @@ -103,7 +105,9 @@ test("save with no primary key in state outputs warning", 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");

Expand All @@ -114,7 +118,9 @@ test("save 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, "isCacheFeatureAvailable").mockImplementation(() => false);
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(
() => false
);

const saveCacheMock = jest.spyOn(cache, "saveCache");

Expand Down Expand Up @@ -158,7 +164,7 @@ test("save on GHES with AC available", async () => {
uploadChunkSize: 4000000
});

expect(failedMock).toHaveBeenCalledTimes(0);
expect(failedMock).toHaveBeenCalledTimes(0);
});

test("save with exact match returns early", async () => {
Expand Down

0 comments on commit c5862e2

Please sign in to comment.