3
0
Fork 0
mirror of https://gitea.com/actions/setup-go.git synced 2024-11-26 03:29:32 +01:00

Add test for export of GOROOT to env var

Signed-off-by: Manuel Mendez <mmendez534@gmail.com>
This commit is contained in:
Manuel Mendez 2021-12-14 13:12:54 -05:00
parent f6164bd8c8
commit ec07be593a

View file

@ -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';