|
|
|
@ -389,3 +389,31 @@ test("save with valid inputs uploads a cache", async () => {
|
|
|
|
|
|
|
|
|
|
expect(failedMock).toHaveBeenCalledTimes(0);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test("save with reevaluate-key uses the key", async () => {
|
|
|
|
|
const failedMock = jest.spyOn(core, "setFailed");
|
|
|
|
|
|
|
|
|
|
const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43";
|
|
|
|
|
|
|
|
|
|
const inputPath = "node_modules";
|
|
|
|
|
testUtils.setInput(Inputs.Path, inputPath);
|
|
|
|
|
testUtils.setInput(Inputs.Key, primaryKey);
|
|
|
|
|
testUtils.setInput(Inputs.ReevaluateKey, "true");
|
|
|
|
|
testUtils.setInput(Inputs.UploadChunkSize, "4000000");
|
|
|
|
|
|
|
|
|
|
const cacheId = 4;
|
|
|
|
|
const saveCacheMock = jest
|
|
|
|
|
.spyOn(cache, "saveCache")
|
|
|
|
|
.mockImplementationOnce(() => {
|
|
|
|
|
return Promise.resolve(cacheId);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await run();
|
|
|
|
|
|
|
|
|
|
expect(saveCacheMock).toHaveBeenCalledTimes(1);
|
|
|
|
|
expect(saveCacheMock).toHaveBeenCalledWith([inputPath], primaryKey, {
|
|
|
|
|
uploadChunkSize: 4000000
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
expect(failedMock).toHaveBeenCalledTimes(0);
|
|
|
|
|
});
|
|
|
|
|