From 9dc0cd064c678c7edd75a57809bc79e004a8b07f Mon Sep 17 00:00:00 2001
From: Sergey-Murtazin <sergey-murtazin@github.com>
Date: Thu, 20 Jan 2022 15:05:48 +0300
Subject: [PATCH] Three tests to fix

---
 __tests__/setup-go.test.ts | 59 ++++++++++++++------------------------
 dist/index.js              |  2 --
 src/installer.ts           |  3 --
 3 files changed, 21 insertions(+), 43 deletions(-)

diff --git a/__tests__/setup-go.test.ts b/__tests__/setup-go.test.ts
index 3ef9128..3be2b12 100644
--- a/__tests__/setup-go.test.ts
+++ b/__tests__/setup-go.test.ts
@@ -596,8 +596,8 @@ describe('setup-go', () => {
       os.platform = 'linux';
       os.arch = 'x64';
 
-      inputs['go-version'] = '1.16.1';
-      inputs['check-latest'] = 'true';
+      inputs['go-version'] = '1.16';
+      inputs['check-latest'] = 'false';
 
       const toolPath = path.normalize('/cache/go/1.16.1/x64');
       findSpy.mockReturnValue(toolPath);
@@ -607,10 +607,7 @@ describe('setup-go', () => {
 
       await main.run();
 
-      expect(logSpy).toHaveBeenCalledWith(
-        'Attempt to resolve the latest version from manifest...'
-      );
-      expect(logSpy).toHaveBeenCalledWith("Resolved as '1.16.1'");
+      expect(logSpy).toHaveBeenCalledWith("Setup go stable version spec 1.16");
       expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
     });
 
@@ -618,12 +615,13 @@ describe('setup-go', () => {
       os.platform = 'linux';
       os.arch = 'x64';
 
-      inputs['go-version'] = '1.16.13';
+      inputs['go-version'] = '1.16';
+      inputs['stable'] = 'false';
       inputs['check-latest'] = 'true';
 
       findSpy.mockImplementation(() => '');
       dlSpy.mockImplementation(async () => '/some/temp/path');
-      const toolPath = path.normalize('/cache/go/1.16.13/x64');
+      const toolPath = path.normalize('/cache/go/1.16.12/x64');
       exSpy.mockImplementation(async () => '/some/other/temp/path');
       cacheSpy.mockImplementation(async () => toolPath);
       const expectedUrl =
@@ -631,15 +629,14 @@ describe('setup-go', () => {
 
       await main.run();
 
-      expect(logSpy).toHaveBeenCalledWith(
-        'Attempt to resolve the latest version from manifest...'
-      );
-      // expect(logSpy).toHaveBeenCalledWith("Resolved as '1.16.13'");
-      expect(logSpy).toHaveBeenCalledWith();
-      expect(logSpy).toHaveBeenCalledWith(
-        `Acquiring 1.16.13 from ${expectedUrl}`
-      );
-      expect(logSpy).toHaveBeenCalledWith('Extracting ...');
+      expect(logSpy).toHaveBeenCalledWith('Attempt to resolve the latest version from manifest...');
+      expect(logSpy).toHaveBeenCalledWith("matching 1.16...");
+      expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
+      // expect(logSpy).toHaveBeenCalledWith("Resolved as '1.16'");
+      // expect(logSpy).toHaveBeenCalledWith("Attempting to download 1.16.13...");
+      // expect(logSpy).toHaveBeenCalledWith("matching 1.16.13...");
+      // expect(logSpy).toHaveBeenCalledWith(`Acquiring 1.16.13 from ${expectedUrl}`);
+      expect(logSpy).toHaveBeenCalledWith('Extracting Go...');
     });
 
     it('fallback to dist if version if not found in manifest', async () => {
@@ -669,15 +666,9 @@ describe('setup-go', () => {
 
       expect(dlSpy).toHaveBeenCalled();
       expect(exSpy).toHaveBeenCalled();
-      expect(logSpy).toHaveBeenCalledWith(
-        'Attempt to resolve the latest version from manifest...'
-      );
-      expect(logSpy).toHaveBeenCalledWith(
-        `Failed to resolve version ${versionSpec} from manifest`
-      );
-      expect(logSpy).toHaveBeenCalledWith(
-        `Attempting to download ${versionSpec}...`
-      );
+      expect(logSpy).toHaveBeenCalledWith('Attempt to resolve the latest version from manifest...');
+      expect(logSpy).toHaveBeenCalledWith(`Failed to resolve version ${versionSpec} from manifest`);
+      expect(logSpy).toHaveBeenCalledWith(`Attempting to download ${versionSpec}...`);
       // TODO: Is this exists. Should be something like `extPath = path.join(extPath, 'go');`
       // expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
     });
@@ -711,18 +702,10 @@ describe('setup-go', () => {
 
       expect(dlSpy).toHaveBeenCalled();
       expect(exSpy).toHaveBeenCalled();
-      expect(logSpy).toHaveBeenCalledWith(
-        'Attempt to resolve the latest version from manifest...'
-      );
-      expect(logSpy).toHaveBeenCalledWith(
-        'Unable to resolve version from manifest...'
-      );
-      expect(logSpy).toHaveBeenCalledWith(
-        `Failed to resolve version ${versionSpec} from manifest`
-      );
-      expect(logSpy).toHaveBeenCalledWith(
-        `Attempting to download ${versionSpec}...`
-      );
+      expect(logSpy).toHaveBeenCalledWith('Attempt to resolve the latest version from manifest...');
+      expect(logSpy).toHaveBeenCalledWith('Unable to resolve version from manifest...');
+      expect(logSpy).toHaveBeenCalledWith(`Failed to resolve version ${versionSpec} from manifest`);
+      expect(logSpy).toHaveBeenCalledWith(`Attempting to download ${versionSpec}...`);
       // expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
     });
   });
diff --git a/dist/index.js b/dist/index.js
index c0d99bc..645d8c5 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -5011,11 +5011,9 @@ const sys = __importStar(__webpack_require__(737));
 const os_1 = __importDefault(__webpack_require__(87));
 function getGo(versionSpec, stable, checkLatest, auth) {
     return __awaiter(this, void 0, void 0, function* () {
-        core.info("DEBUG: Inside getGo");
         let osPlat = os_1.default.platform();
         let osArch = os_1.default.arch();
         if (checkLatest) {
-            core.info(`DEBUG: Inside is checkLatest: ${checkLatest}`);
             core.info('Attempt to resolve the latest version from manifest...');
             const resolvedVersion = yield resolveVersionFromManifest(versionSpec, stable, auth);
             if (resolvedVersion) {
diff --git a/src/installer.ts b/src/installer.ts
index 42c6fb8..7285215 100644
--- a/src/installer.ts
+++ b/src/installer.ts
@@ -34,13 +34,10 @@ export async function getGo(
   checkLatest: boolean,
   auth: string | undefined
 ) {
-  core.info("DEBUG: Inside getGo")
   let osPlat: string = os.platform();
   let osArch: string = os.arch();
   
   if (checkLatest) {
-    core.info(`DEBUG: Inside is checkLatest: ${checkLatest}`)
-
     core.info('Attempt to resolve the latest version from manifest...');
     const resolvedVersion = await resolveVersionFromManifest(
       versionSpec,