diff --git a/__tests__/cache.test.ts b/__tests__/cache.test.ts index eaa0192..d167432 100644 --- a/__tests__/cache.test.ts +++ b/__tests__/cache.test.ts @@ -111,6 +111,22 @@ describe("sdkCachePath", () => { process.env.RUNNER_TOOL_CACHE = original; } }); + + // On a runner RUNNER_TOOL_CACHE is always set, so the fallback is only + // reached when this test clears it. + it("falls back to the default tool cache without RUNNER_TOOL_CACHE", () => { + const original = process.env.RUNNER_TOOL_CACHE; + delete process.env.RUNNER_TOOL_CACHE; + try { + expect(sdkCachePath("3.29.0", "stable", "x64")).toContain( + "/opt/hostedtoolcache", + ); + } finally { + if (original !== undefined) { + process.env.RUNNER_TOOL_CACHE = original; + } + } + }); }); describe("isValidLocalSdk", () => { diff --git a/__tests__/version.test.ts b/__tests__/version.test.ts index be75cae..0d48e0a 100644 --- a/__tests__/version.test.ts +++ b/__tests__/version.test.ts @@ -667,6 +667,18 @@ describe("fetchManifest", () => { expect(getJson).toHaveBeenCalledTimes(3); }); + it("wraps a non-Error rejection", async () => { + const getJson = vi.fn().mockRejectedValue("socket hang up"); + HttpClient.mockImplementation( + class { + getJson = getJson; + }, + ); + + await expect(fetchManifest("linux")).rejects.toThrow("socket hang up"); + expect(getJson).toHaveBeenCalledTimes(3); + }); + it("does not retry on HTTP 403", async () => { const getJson = vi .fn()