From 80a5cc18ca99b6033513ce8ae6fd046a0a721606 Mon Sep 17 00:00:00 2001 From: whywaita Date: Wed, 18 Oct 2023 01:06:40 +0900 Subject: [PATCH] Fix test --- __tests__/restore.test.ts | 28 ++++++++++++++++++++------- __tests__/restoreImpl.test.ts | 36 ++++++++++++++++++++++++++--------- __tests__/restoreOnly.test.ts | 16 ++++++++++++---- __tests__/save.test.ts | 4 +++- __tests__/saveImpl.test.ts | 20 ++++++++++++++----- __tests__/saveOnly.test.ts | 8 ++++++-- 6 files changed, 84 insertions(+), 28 deletions(-) diff --git a/__tests__/restore.test.ts b/__tests__/restore.test.ts index 250f7ef59..645bdfa5a 100644 --- a/__tests__/restore.test.ts +++ b/__tests__/restore.test.ts @@ -81,7 +81,9 @@ test("restore with no cache found", async () => { { lookupOnly: false }, - false + false, + undefined, + "", ); expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); @@ -124,7 +126,9 @@ test("restore with restore keys and no cache found", async () => { { lookupOnly: false }, - false + false, + undefined, + "", ); expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); @@ -166,7 +170,9 @@ test("restore with cache found for key", async () => { { lookupOnly: false }, - false + false, + undefined, + "", ); expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); @@ -211,7 +217,9 @@ test("restore with cache found for restore key", async () => { { lookupOnly: false }, - false + false, + undefined, + "", ); expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); @@ -256,7 +264,9 @@ test("Fail restore when fail on cache miss is enabled and primary + restore keys { lookupOnly: false }, - false + false, + undefined, + "", ); expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); @@ -299,7 +309,9 @@ test("restore when fail on cache miss is enabled and primary key doesn't match r { lookupOnly: false }, - false + false, + undefined, + "", ); expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); @@ -345,7 +357,9 @@ test("restore with fail on cache miss disabled and no cache found", async () => { lookupOnly: false }, - false + false, + undefined, + "", ); expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); diff --git a/__tests__/restoreImpl.test.ts b/__tests__/restoreImpl.test.ts index 8bab894ef..3d0c1a8ce 100644 --- a/__tests__/restoreImpl.test.ts +++ b/__tests__/restoreImpl.test.ts @@ -129,7 +129,9 @@ test("restore on GHES with AC available ", async () => { { lookupOnly: false }, - false + false, + undefined, + "", ); expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); @@ -183,7 +185,9 @@ test("restore with too many keys should fail", async () => { { lookupOnly: false }, - false + false, + undefined, + "", ); expect(failedMock).toHaveBeenCalledWith( `Key Validation Error: Keys are limited to a maximum of 10.` @@ -209,7 +213,9 @@ test("restore with large key should fail", async () => { { lookupOnly: false }, - false + false, + undefined, + "", ); expect(failedMock).toHaveBeenCalledWith( `Key Validation Error: ${key} cannot be larger than 512 characters.` @@ -235,7 +241,9 @@ test("restore with invalid key should fail", async () => { { lookupOnly: false }, - false + false, + undefined, + "", ); expect(failedMock).toHaveBeenCalledWith( `Key Validation Error: ${key} cannot contain commas.` @@ -270,7 +278,9 @@ test("restore with no cache found", async () => { { lookupOnly: false }, - false + false, + undefined, + "", ); expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); @@ -311,7 +321,9 @@ test("restore with restore keys and no cache found", async () => { { lookupOnly: false }, - false + false, + undefined, + "", ); expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); @@ -351,7 +363,9 @@ test("restore with cache found for key", async () => { { lookupOnly: false }, - false + false, + undefined, + "", ); expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); @@ -393,7 +407,9 @@ test("restore with cache found for restore key", async () => { { lookupOnly: false }, - false + false, + undefined, + "", ); expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); @@ -434,7 +450,9 @@ test("restore with lookup-only set", async () => { { lookupOnly: true }, - false + false, + undefined, + "", ); expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key); diff --git a/__tests__/restoreOnly.test.ts b/__tests__/restoreOnly.test.ts index 81e5bcac1..0910713a1 100644 --- a/__tests__/restoreOnly.test.ts +++ b/__tests__/restoreOnly.test.ts @@ -82,7 +82,9 @@ test("restore with no cache found", async () => { { lookupOnly: false }, - false + false, + undefined, + "", ); expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key); @@ -124,7 +126,9 @@ test("restore with restore keys and no cache found", async () => { { lookupOnly: false }, - false + false, + undefined, + "", ); expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key); @@ -163,7 +167,9 @@ test("restore with cache found for key", async () => { { lookupOnly: false }, - false + false, + undefined, + "", ); expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key); @@ -206,7 +212,9 @@ test("restore with cache found for restore key", async () => { { lookupOnly: false }, - false + false, + undefined, + "", ); expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key); diff --git a/__tests__/save.test.ts b/__tests__/save.test.ts index 1eb9c7b8d..3d428ea96 100644 --- a/__tests__/save.test.ts +++ b/__tests__/save.test.ts @@ -109,7 +109,9 @@ test("save with valid inputs uploads a cache", async () => { { uploadChunkSize: 4000000 }, - false + false, + undefined, + "", ); expect(failedMock).toHaveBeenCalledTimes(0); diff --git a/__tests__/saveImpl.test.ts b/__tests__/saveImpl.test.ts index 2a048b0d9..7014770c7 100644 --- a/__tests__/saveImpl.test.ts +++ b/__tests__/saveImpl.test.ts @@ -170,7 +170,9 @@ test("save on GHES with AC available", async () => { { uploadChunkSize: 4000000 }, - false + false, + undefined, + "", ); expect(failedMock).toHaveBeenCalledTimes(0); @@ -266,7 +268,9 @@ test("save with large cache outputs warning", async () => { [inputPath], primaryKey, expect.anything(), - false + false, + undefined, + "", ); expect(logWarningMock).toHaveBeenCalledTimes(1); @@ -313,7 +317,9 @@ test("save with reserve cache failure outputs warning", async () => { [inputPath], primaryKey, expect.anything(), - false + false, + undefined, + "", ); expect(logWarningMock).toHaveBeenCalledWith( @@ -356,7 +362,9 @@ test("save with server error outputs warning", async () => { [inputPath], primaryKey, expect.anything(), - false + false, + undefined, + "", ); expect(logWarningMock).toHaveBeenCalledTimes(1); @@ -401,7 +409,9 @@ test("save with valid inputs uploads a cache", async () => { { uploadChunkSize: 4000000 }, - false + false, + undefined, + "", ); expect(failedMock).toHaveBeenCalledTimes(0); diff --git a/__tests__/saveOnly.test.ts b/__tests__/saveOnly.test.ts index 5a7f8b04e..0274cce3a 100644 --- a/__tests__/saveOnly.test.ts +++ b/__tests__/saveOnly.test.ts @@ -99,7 +99,9 @@ test("save with valid inputs uploads a cache", async () => { { uploadChunkSize: 4000000 }, - false + false, + undefined, + "", ); expect(failedMock).toHaveBeenCalledTimes(0); @@ -131,7 +133,9 @@ test("save failing logs the warning message", async () => { { uploadChunkSize: 4000000 }, - false + false, + undefined, + "", ); expect(warningMock).toHaveBeenCalledTimes(1);