mirror of
https://github.com/actions/setup-go
synced 2024-12-22 06:12:42 +00:00
Add test for export of GOROOT to env var
Signed-off-by: Manuel Mendez <mmendez534@gmail.com>
This commit is contained in:
parent
f6164bd8c8
commit
ec07be593a
1 changed files with 17 additions and 0 deletions
|
@ -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 = {};
|
||||
|
@ -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';
|
||||
|
||||
|
|
Loading…
Reference in a new issue