Skip to content

Commit

Permalink
Add test for export of GOROOT to env var
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Mendez <mmendez534@gmail.com>
  • Loading branch information
mmlb committed Dec 14, 2021
1 parent 3e9d548 commit 9735516
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions __tests__/setup-go.test.ts
Expand Up @@ -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 = {};
Expand Down Expand Up @@ -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';

Expand Down

0 comments on commit 9735516

Please sign in to comment.