This commit is contained in:
Eman Resu 2025-03-21 18:05:18 +09:00 committed by GitHub
commit ced0952007
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 32 additions and 13 deletions

View file

@ -85,7 +85,8 @@ test("restore with no cache found", async () => {
);
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
expect(stateMock).toHaveBeenCalledTimes(1);
expect(stateMock).toHaveBeenCalledWith("CACHE_PATH", path);
expect(stateMock).toHaveBeenCalledTimes(2);
expect(failedMock).toHaveBeenCalledTimes(0);
@ -128,7 +129,8 @@ test("restore with restore keys and no cache found", async () => {
);
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
expect(stateMock).toHaveBeenCalledTimes(1);
expect(stateMock).toHaveBeenCalledWith("CACHE_PATH", path);
expect(stateMock).toHaveBeenCalledTimes(2);
expect(failedMock).toHaveBeenCalledTimes(0);
@ -171,7 +173,8 @@ test("restore with cache found for key", async () => {
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
expect(stateMock).toHaveBeenCalledWith("CACHE_RESULT", key);
expect(stateMock).toHaveBeenCalledTimes(2);
expect(stateMock).toHaveBeenCalledWith("CACHE_PATH", path);
expect(stateMock).toHaveBeenCalledTimes(3);
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "true");
@ -216,7 +219,8 @@ test("restore with cache found for restore key", async () => {
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
expect(stateMock).toHaveBeenCalledWith("CACHE_RESULT", restoreKey);
expect(stateMock).toHaveBeenCalledTimes(2);
expect(stateMock).toHaveBeenCalledWith("CACHE_PATH", path);
expect(stateMock).toHaveBeenCalledTimes(3);
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "false");
@ -304,7 +308,8 @@ test("restore when fail on cache miss is enabled and primary key doesn't match r
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
expect(stateMock).toHaveBeenCalledWith("CACHE_RESULT", restoreKey);
expect(stateMock).toHaveBeenCalledTimes(2);
expect(stateMock).toHaveBeenCalledWith("CACHE_PATH", path);
expect(stateMock).toHaveBeenCalledTimes(3);
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "false");
@ -349,7 +354,8 @@ test("restore with fail on cache miss disabled and no cache found", async () =>
);
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
expect(stateMock).toHaveBeenCalledTimes(1);
expect(stateMock).toHaveBeenCalledWith("CACHE_PATH", path);
expect(stateMock).toHaveBeenCalledTimes(2);
expect(infoMock).toHaveBeenCalledWith(
`Cache not found for input keys: ${key}, ${restoreKey}`

View file

@ -439,7 +439,8 @@ test("restore with lookup-only set", async () => {
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
expect(stateMock).toHaveBeenCalledWith("CACHE_RESULT", key);
expect(stateMock).toHaveBeenCalledTimes(2);
expect(stateMock).toHaveBeenCalledWith("CACHE_PATH", path);
expect(stateMock).toHaveBeenCalledTimes(3);
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "true");

View file

@ -86,7 +86,8 @@ test("restore with no cache found", async () => {
);
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
expect(outputMock).toHaveBeenCalledTimes(1);
expect(outputMock).toHaveBeenCalledWith("cache-path", path);
expect(outputMock).toHaveBeenCalledTimes(2);
expect(failedMock).toHaveBeenCalledTimes(0);
expect(infoMock).toHaveBeenCalledWith(
@ -128,6 +129,7 @@ test("restore with restore keys and no cache found", async () => {
);
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
expect(outputMock).toHaveBeenCalledWith("cache-path", path);
expect(failedMock).toHaveBeenCalledTimes(0);
expect(infoMock).toHaveBeenCalledWith(
@ -169,8 +171,9 @@ test("restore with cache found for key", async () => {
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
expect(outputMock).toHaveBeenCalledWith("cache-hit", "true");
expect(outputMock).toHaveBeenCalledWith("cache-matched-key", key);
expect(outputMock).toHaveBeenCalledWith("cache-path", path);
expect(outputMock).toHaveBeenCalledTimes(3);
expect(outputMock).toHaveBeenCalledTimes(4);
expect(infoMock).toHaveBeenCalledWith(`Cache restored from key: ${key}`);
expect(failedMock).toHaveBeenCalledTimes(0);
@ -212,8 +215,9 @@ test("restore with cache found for restore key", async () => {
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
expect(outputMock).toHaveBeenCalledWith("cache-hit", "false");
expect(outputMock).toHaveBeenCalledWith("cache-matched-key", restoreKey);
expect(outputMock).toHaveBeenCalledWith("cache-path", path);
expect(outputMock).toHaveBeenCalledTimes(3);
expect(outputMock).toHaveBeenCalledTimes(4);
expect(infoMock).toHaveBeenCalledWith(
`Cache restored from key: ${restoreKey}`