diff --git a/__tests__/setup-go.test.ts b/__tests__/setup-go.test.ts index c90d74b82..a0018394c 100644 --- a/__tests__/setup-go.test.ts +++ b/__tests__/setup-go.test.ts @@ -45,6 +45,7 @@ describe('setup-go', () => { inputs = {}; inSpy = jest.spyOn(core, 'getInput'); inSpy.mockImplementation(name => inputs[name]); + exSpy = jest.spyOn(core, 'exportVariable'); // node os = {}; @@ -229,6 +230,22 @@ describe('setup-go', () => { expect(logSpy).toHaveBeenCalledWith(`Setup go stable version spec 1.13.0`); }); + it('exports GOROOT', async () => { + inputs['go-version'] = '1.13.0'; + inSpy.mockImplementation(name => inputs[name]); + + let toolPath = path.normalize('/cache/go/1.13.0/x64'); + findSpy.mockImplementation(() => toolPath); + + let vars = {} as any; + exSpy.mockImplementation(async(name, val) => { + vars[name] = val + }); + + await main.run(); + expect(vars).toBe({'GOROOT': 'foo'}); + }); + it('finds a version of go already in the cache', async () => { inputs['go-version'] = '1.13.0';