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 Mar 9, 2022
1 parent f6164bd commit ec07be5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions __tests__/setup-go.test.ts
Expand Up @@ -49,6 +49,7 @@ describe('setup-go', () => {
inSpy.mockImplementation(name => inputs[name]);
getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput');
getBooleanInputSpy.mockImplementation(name => inputs[name]);
exSpy = jest.spyOn(core, 'exportVariable');

// node
os = {};
Expand Down Expand Up @@ -230,6 +231,22 @@ describe('setup-go', () => {
expect(logSpy).toHaveBeenCalledWith(`Setup go 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 ec07be5

Please sign in to comment.