1
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2025-05-10 19:19:54 +02:00

npm run format

This commit is contained in:
BSKY 2020-03-23 23:35:15 +09:00
parent 150eacd6fa
commit 1729a4d479
19 changed files with 222 additions and 206 deletions

View file

@ -51,7 +51,7 @@ test("isExactKeyMatch with empty cache entry returns false", () => {
test("isExactKeyMatch with different keys returns false", () => {
const key = "linux-rust";
const cacheEntry: ArtifactCacheEntry = {
cacheKey: "linux-"
cacheKey: "linux-",
};
expect(actionUtils.isExactKeyMatch(key, cacheEntry)).toBe(false);
@ -60,7 +60,7 @@ test("isExactKeyMatch with different keys returns false", () => {
test("isExactKeyMatch with different key accents returns false", () => {
const key = "linux-áccent";
const cacheEntry: ArtifactCacheEntry = {
cacheKey: "linux-accent"
cacheKey: "linux-accent",
};
expect(actionUtils.isExactKeyMatch(key, cacheEntry)).toBe(false);
@ -69,7 +69,7 @@ test("isExactKeyMatch with different key accents returns false", () => {
test("isExactKeyMatch with same key returns true", () => {
const key = "linux-rust";
const cacheEntry: ArtifactCacheEntry = {
cacheKey: "linux-rust"
cacheKey: "linux-rust",
};
expect(actionUtils.isExactKeyMatch(key, cacheEntry)).toBe(true);
@ -78,7 +78,7 @@ test("isExactKeyMatch with same key returns true", () => {
test("isExactKeyMatch with same key and different casing returns true", () => {
const key = "linux-rust";
const cacheEntry: ArtifactCacheEntry = {
cacheKey: "LINUX-RUST"
cacheKey: "LINUX-RUST",
};
expect(actionUtils.isExactKeyMatch(key, cacheEntry)).toBe(true);
@ -102,7 +102,7 @@ test("setOutputAndState with undefined entry to set cache-hit output", () => {
test("setOutputAndState with exact match to set cache-hit output and state", () => {
const key = "linux-rust";
const cacheEntry: ArtifactCacheEntry = {
cacheKey: "linux-rust"
cacheKey: "linux-rust",
};
const setOutputMock = jest.spyOn(core, "setOutput");
@ -123,7 +123,7 @@ test("setOutputAndState with exact match to set cache-hit output and state", ()
test("setOutputAndState with no exact match to set cache-hit output and state", () => {
const key = "linux-rust";
const cacheEntry: ArtifactCacheEntry = {
cacheKey: "linux-rust-bb828da54c148048dd17899ba9fda624811cfb43"
cacheKey: "linux-rust-bb828da54c148048dd17899ba9fda624811cfb43",
};
const setOutputMock = jest.spyOn(core, "setOutput");
@ -160,7 +160,7 @@ test("getCacheState with valid state", () => {
cacheKey: "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43",
scope: "refs/heads/master",
creationTime: "2019-11-13T19:18:02+00:00",
archiveLocation: "www.actionscache.test/download"
archiveLocation: "www.actionscache.test/download",
};
const getStateMock = jest.spyOn(core, "getState");
getStateMock.mockImplementation(() => {

View file

@ -73,11 +73,11 @@ test("restore with no key", async () => {
test("restore with too many keys should fail", async () => {
const key = "node-test";
const restoreKeys = [...Array(20).keys()].map(x => x.toString());
const restoreKeys = [...Array(20).keys()].map((x) => x.toString());
testUtils.setInputs({
path: "node_modules",
key,
restoreKeys
restoreKeys,
});
const failedMock = jest.spyOn(core, "setFailed");
await run();
@ -90,7 +90,7 @@ test("restore with large key should fail", async () => {
const key = "foo".repeat(512); // Over the 512 character limit
testUtils.setInputs({
path: "node_modules",
key
key,
});
const failedMock = jest.spyOn(core, "setFailed");
await run();
@ -103,7 +103,7 @@ test("restore with invalid key should fail", async () => {
const key = "comma,comma";
testUtils.setInputs({
path: "node_modules",
key
key,
});
const failedMock = jest.spyOn(core, "setFailed");
await run();
@ -116,7 +116,7 @@ test("restore with no cache found", async () => {
const key = "node-test";
testUtils.setInputs({
path: "node_modules",
key
key,
});
const infoMock = jest.spyOn(core, "info");
@ -142,7 +142,7 @@ test("restore with server error should fail", async () => {
const key = "node-test";
testUtils.setInputs({
path: "node_modules",
key
key,
});
const logWarningMock = jest.spyOn(actionUtils, "logWarning");
@ -175,7 +175,7 @@ test("restore with restore keys and no cache found", async () => {
testUtils.setInputs({
path: "node_modules",
key,
restoreKeys: [restoreKey]
restoreKeys: [restoreKey],
});
const infoMock = jest.spyOn(core, "info");
@ -201,7 +201,7 @@ test("restore with cache found", async () => {
const key = "node-test";
testUtils.setInputs({
path: "node_modules",
key
key,
});
const infoMock = jest.spyOn(core, "info");
@ -211,7 +211,7 @@ test("restore with cache found", async () => {
const cacheEntry: ArtifactCacheEntry = {
cacheKey: key,
scope: "refs/heads/master",
archiveLocation: "www.actionscache.test/download"
archiveLocation: "www.actionscache.test/download",
};
const getCacheMock = jest.spyOn(cacheHttpClient, "getCacheEntry");
getCacheMock.mockImplementation(() => {
@ -269,7 +269,7 @@ test("restore with a pull request event and cache found", async () => {
const key = "node-test";
testUtils.setInputs({
path: "node_modules",
key
key,
});
process.env[Events.Key] = Events.PullRequest;
@ -281,7 +281,7 @@ test("restore with a pull request event and cache found", async () => {
const cacheEntry: ArtifactCacheEntry = {
cacheKey: key,
scope: "refs/heads/master",
archiveLocation: "www.actionscache.test/download"
archiveLocation: "www.actionscache.test/download",
};
const getCacheMock = jest.spyOn(cacheHttpClient, "getCacheEntry");
getCacheMock.mockImplementation(() => {
@ -338,7 +338,7 @@ test("restore with cache found for restore key", async () => {
testUtils.setInputs({
path: "node_modules",
key,
restoreKeys: [restoreKey]
restoreKeys: [restoreKey],
});
const infoMock = jest.spyOn(core, "info");
@ -348,7 +348,7 @@ test("restore with cache found for restore key", async () => {
const cacheEntry: ArtifactCacheEntry = {
cacheKey: restoreKey,
scope: "refs/heads/master",
archiveLocation: "www.actionscache.test/download"
archiveLocation: "www.actionscache.test/download",
};
const getCacheMock = jest.spyOn(cacheHttpClient, "getCacheEntry");
getCacheMock.mockImplementation(() => {

View file

@ -42,8 +42,8 @@ beforeAll(() => {
});
jest.spyOn(actionUtils, "resolvePaths").mockImplementation(
async filePaths => {
return filePaths.map(x => path.resolve(x));
async (filePaths) => {
return filePaths.map((x) => path.resolve(x));
}
);
@ -81,7 +81,7 @@ test("save with no primary key in state outputs warning", async () => {
cacheKey: "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43",
scope: "refs/heads/master",
creationTime: "2019-11-13T19:18:02+00:00",
archiveLocation: "www.actionscache.test/download"
archiveLocation: "www.actionscache.test/download",
};
jest.spyOn(core, "getState")
@ -112,7 +112,7 @@ test("save with exact match returns early", async () => {
cacheKey: primaryKey,
scope: "refs/heads/master",
creationTime: "2019-11-13T19:18:02+00:00",
archiveLocation: "www.actionscache.test/download"
archiveLocation: "www.actionscache.test/download",
};
jest.spyOn(core, "getState")
@ -147,7 +147,7 @@ test("save with missing input outputs warning", async () => {
cacheKey: "Linux-node-",
scope: "refs/heads/master",
creationTime: "2019-11-13T19:18:02+00:00",
archiveLocation: "www.actionscache.test/download"
archiveLocation: "www.actionscache.test/download",
};
jest.spyOn(core, "getState")
@ -178,7 +178,7 @@ test("save with large cache outputs warning", async () => {
cacheKey: "Linux-node-",
scope: "refs/heads/master",
creationTime: "2019-11-13T19:18:02+00:00",
archiveLocation: "www.actionscache.test/download"
archiveLocation: "www.actionscache.test/download",
};
jest.spyOn(core, "getState")
@ -227,7 +227,7 @@ test("save with reserve cache failure outputs warning", async () => {
cacheKey: "Linux-node-",
scope: "refs/heads/master",
creationTime: "2019-11-13T19:18:02+00:00",
archiveLocation: "www.actionscache.test/download"
archiveLocation: "www.actionscache.test/download",
};
jest.spyOn(core, "getState")
@ -277,7 +277,7 @@ test("save with server error outputs warning", async () => {
cacheKey: "Linux-node-",
scope: "refs/heads/master",
creationTime: "2019-11-13T19:18:02+00:00",
archiveLocation: "www.actionscache.test/download"
archiveLocation: "www.actionscache.test/download",
};
jest.spyOn(core, "getState")
@ -337,7 +337,7 @@ test("save with valid inputs uploads a cache", async () => {
cacheKey: "Linux-node-",
scope: "refs/heads/master",
creationTime: "2019-11-13T19:18:02+00:00",
archiveLocation: "www.actionscache.test/download"
archiveLocation: "www.actionscache.test/download",
};
jest.spyOn(core, "getState")

View file

@ -14,7 +14,7 @@ function getTempDir(): string {
}
beforeAll(async () => {
jest.spyOn(io, "which").mockImplementation(tool => {
jest.spyOn(io, "which").mockImplementation((tool) => {
return Promise.resolve(tool);
});
@ -76,10 +76,10 @@ test("create tar", async () => {
"-C",
workspace,
"--files-from",
"manifest.txt"
"manifest.txt",
],
{
cwd: archiveFolder
cwd: archiveFolder,
}
);
});