From 7c59aeb02d3ccdcf05a6f8e6f431b8a9f0ee0688 Mon Sep 17 00:00:00 2001
From: Shubham Tiwari <64764738+tiwarishub@users.noreply.github.com>
Date: Fri, 24 Jun 2022 05:04:57 +0000
Subject: [PATCH] formatting and error

---
 .licenses/npm/@actions/cache.dep.yml |  2 +-
 __tests__/restore.test.ts            | 34 ----------------------------
 src/restore.ts                       |  4 ++--
 src/save.ts                          | 10 ++++----
 4 files changed, 8 insertions(+), 42 deletions(-)

diff --git a/.licenses/npm/@actions/cache.dep.yml b/.licenses/npm/@actions/cache.dep.yml
index e2af04c..cb0614a 100644
--- a/.licenses/npm/@actions/cache.dep.yml
+++ b/.licenses/npm/@actions/cache.dep.yml
@@ -1,6 +1,6 @@
 ---
 name: "@actions/cache"
-version: 2.0.6
+version: 3.0.0
 type: npm
 summary: 
 homepage: 
diff --git a/__tests__/restore.test.ts b/__tests__/restore.test.ts
index b4dbba9..e9a505b 100644
--- a/__tests__/restore.test.ts
+++ b/__tests__/restore.test.ts
@@ -227,40 +227,6 @@ test("restore with no cache found", async () => {
     );
 });
 
-test("restore with server error should fail", async () => {
-    const path = "node_modules";
-    const key = "node-test";
-    testUtils.setInputs({
-        path: path,
-        key
-    });
-
-    const logWarningMock = jest.spyOn(actionUtils, "logWarning");
-    const failedMock = jest.spyOn(core, "setFailed");
-    const stateMock = jest.spyOn(core, "saveState");
-    const restoreCacheMock = jest
-        .spyOn(cache, "restoreCache")
-        .mockImplementationOnce(() => {
-            throw new Error("HTTP Error Occurred");
-        });
-    const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput");
-
-    await run();
-
-    expect(restoreCacheMock).toHaveBeenCalledTimes(1);
-    expect(restoreCacheMock).toHaveBeenCalledWith([path], key, []);
-
-    expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
-
-    expect(logWarningMock).toHaveBeenCalledTimes(1);
-    expect(logWarningMock).toHaveBeenCalledWith("HTTP Error Occurred");
-
-    expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
-    expect(setCacheHitOutputMock).toHaveBeenCalledWith(false);
-
-    expect(failedMock).toHaveBeenCalledTimes(0);
-});
-
 test("restore with restore keys and no cache found", async () => {
     const path = "node_modules";
     const key = "node-test";
diff --git a/src/restore.ts b/src/restore.ts
index bf05759..5bc17fa 100644
--- a/src/restore.ts
+++ b/src/restore.ts
@@ -34,13 +34,13 @@ async function run(): Promise<void> {
             primaryKey,
             restoreKeys
         );
-        
+
         if (!cacheKey) {
             core.info(
                 `Cache not found for input keys: ${[
                     primaryKey,
                     ...restoreKeys
-                 ].join(", ")}`
+                ].join(", ")}`
             );
 
             return;
diff --git a/src/save.ts b/src/save.ts
index 108bd87..821a18d 100644
--- a/src/save.ts
+++ b/src/save.ts
@@ -44,13 +44,13 @@ async function run(): Promise<void> {
             required: true
         });
 
-        const cacheId =  await cache.saveCache(cachePaths, primaryKey, {
-                                    uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize)
-                                });
-        if (cacheId == -1 ) {
+        const cacheId = await cache.saveCache(cachePaths, primaryKey, {
+            uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize)
+        });
+        if (cacheId == -1) {
             return;
         }
-       
+
         core.info(`Cache saved with key: ${primaryKey}`);
     } catch (error: unknown) {
         utils.logWarning((error as Error).message);