Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cachePath as an output for easier access #1436

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update tests to account for changes
  • Loading branch information
Ella Kramer authored and Ella Kramer committed Jul 19, 2024
commit fa8c252a0bcd2c443efb1b37bc25892623c29719
18 changes: 12 additions & 6 deletions __tests__/restore.test.ts
Original file line number Diff line number Diff line change
@@ -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}`
3 changes: 2 additions & 1 deletion __tests__/restoreImpl.test.ts
Original file line number Diff line number Diff line change
@@ -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");