Fix test names and test URL

This commit is contained in:
Josh Gross 2019-11-06 12:55:04 -05:00
parent fb677d1324
commit f9e27a3dfd

View file

@ -36,7 +36,7 @@ afterEach(() => {
testUtils.clearInputs(); testUtils.clearInputs();
}); });
test("restore with no path", async () => { test("restore with no path should fail", async () => {
const failedMock = jest.spyOn(core, "setFailed"); const failedMock = jest.spyOn(core, "setFailed");
await run(); await run();
expect(failedMock).toHaveBeenCalledWith( expect(failedMock).toHaveBeenCalledWith(
@ -53,7 +53,7 @@ test("restore with no key", async () => {
); );
}); });
test("restore with too many keys", async () => { test("restore with too many keys should fail", async () => {
const key = "node-test"; const key = "node-test";
const restoreKeys = [...Array(20).keys()].map(x => x.toString()); const restoreKeys = [...Array(20).keys()].map(x => x.toString());
testUtils.setInputs({ testUtils.setInputs({
@ -68,7 +68,7 @@ test("restore with too many keys", async () => {
); );
}); });
test("restore with large key", async () => { test("restore with large key should fail", async () => {
const key = "foo".repeat(512); // Over the 512 character limit const key = "foo".repeat(512); // Over the 512 character limit
testUtils.setInputs({ testUtils.setInputs({
path: "node_modules", path: "node_modules",
@ -81,7 +81,7 @@ test("restore with large key", async () => {
); );
}); });
test("restore with invalid key", async () => { test("restore with invalid key should fail", async () => {
const key = "comma,comma"; const key = "comma,comma";
testUtils.setInputs({ testUtils.setInputs({
path: "node_modules", path: "node_modules",
@ -122,7 +122,7 @@ test("restore with no cache found", async () => {
); );
}); });
test("restore with no server error", async () => { test("restore with server error should fail", async () => {
const key = "node-test"; const key = "node-test";
testUtils.setInputs({ testUtils.setInputs({
path: "node_modules", path: "node_modules",
@ -153,7 +153,7 @@ test("restore with no server error", async () => {
expect(failedMock).toHaveBeenCalledTimes(0); expect(failedMock).toHaveBeenCalledTimes(0);
}); });
test("restore with restore keys no cache found", async () => { test("restore with restore keys and no cache found", async () => {
const key = "node-test"; const key = "node-test";
const restoreKey = "node-"; const restoreKey = "node-";
testUtils.setInputs({ testUtils.setInputs({
@ -199,7 +199,7 @@ test("restore with cache found", async () => {
const cacheEntry: ArtifactCacheEntry = { const cacheEntry: ArtifactCacheEntry = {
cacheKey: key, cacheKey: key,
scope: "refs/heads/master", scope: "refs/heads/master",
archiveLocation: "https://www.example.com/download" archiveLocation: "www.actionscache.test/download"
}; };
const getCacheMock = jest.spyOn(cacheHttpClient, "getCacheEntry"); const getCacheMock = jest.spyOn(cacheHttpClient, "getCacheEntry");
getCacheMock.mockImplementation(_ => { getCacheMock.mockImplementation(_ => {
@ -275,7 +275,7 @@ test("restore with cache found for restore key", async () => {
const cacheEntry: ArtifactCacheEntry = { const cacheEntry: ArtifactCacheEntry = {
cacheKey: restoreKey, cacheKey: restoreKey,
scope: "refs/heads/master", scope: "refs/heads/master",
archiveLocation: "https://www.example.com/download" archiveLocation: "www.actionscache.test/download"
}; };
const getCacheMock = jest.spyOn(cacheHttpClient, "getCacheEntry"); const getCacheMock = jest.spyOn(cacheHttpClient, "getCacheEntry");
getCacheMock.mockImplementation(_ => { getCacheMock.mockImplementation(_ => {