From 306f72536b44ddb5d2a1a1d8413a33eb8979df7b Mon Sep 17 00:00:00 2001
From: Aiqiao Yan <aiyan@microsoft.com>
Date: Fri, 10 Apr 2020 15:26:15 -0400
Subject: [PATCH] Fix test

---
 __tests__/tar.test.ts | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/__tests__/tar.test.ts b/__tests__/tar.test.ts
index 2690fa9..7055f08 100644
--- a/__tests__/tar.test.ts
+++ b/__tests__/tar.test.ts
@@ -1,11 +1,12 @@
 import * as exec from "@actions/exec";
 import * as io from "@actions/io";
-import * as fs from "fs";
 import * as path from "path";
 
 import { CacheFilename } from "../src/constants";
 import * as tar from "../src/tar";
 
+import fs = require("fs");
+
 jest.mock("@actions/exec");
 jest.mock("@actions/io");
 
@@ -62,25 +63,18 @@ test("extract BSD tar", async () => {
 test("extract GNU tar", async () => {
     const IS_WINDOWS = process.platform === "win32";
     if (IS_WINDOWS) {
-        jest.mock("fs");
+        jest.spyOn(fs, "existsSync").mockReturnValueOnce(false);
+        jest.spyOn(tar, "isGnuTar").mockReturnValue(Promise.resolve(true));
 
         const execMock = jest.spyOn(exec, "exec");
-        const existsSyncMock = jest
-            .spyOn(fs, "existsSync")
-            .mockReturnValue(false);
-        const isGnuTarMock = jest
-            .spyOn(tar, "isGnuTar")
-            .mockReturnValue(Promise.resolve(true));
         const archivePath = `${process.env["windir"]}\\fakepath\\cache.tar`;
         const workspace = process.env["GITHUB_WORKSPACE"];
 
         await tar.extractTar(archivePath);
 
-        expect(existsSyncMock).toHaveBeenCalledTimes(1);
-        expect(isGnuTarMock).toHaveBeenCalledTimes(1);
         expect(execMock).toHaveBeenCalledTimes(2);
         expect(execMock).toHaveBeenLastCalledWith(
-            "tar",
+            `"tar"`,
             [
                 "-xz",
                 "-f",