mirror of
https://codeberg.org/actions/setup-go.git
synced 2024-01-07 17:16:05 +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
|
@ -49,6 +49,7 @@ describe('setup-go', () => {
|
||||||
inSpy.mockImplementation(name => inputs[name]);
|
inSpy.mockImplementation(name => inputs[name]);
|
||||||
getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput');
|
getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput');
|
||||||
getBooleanInputSpy.mockImplementation(name => inputs[name]);
|
getBooleanInputSpy.mockImplementation(name => inputs[name]);
|
||||||
|
exSpy = jest.spyOn(core, 'exportVariable');
|
||||||
|
|
||||||
// node
|
// node
|
||||||
os = {};
|
os = {};
|
||||||
|
@ -230,6 +231,22 @@ describe('setup-go', () => {
|
||||||
expect(logSpy).toHaveBeenCalledWith(`Setup go version spec 1.13.0`);
|
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 () => {
|
it('finds a version of go already in the cache', async () => {
|
||||||
inputs['go-version'] = '1.13.0';
|
inputs['go-version'] = '1.13.0';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue