mirror of
https://github.com/actions/setup-go.git
synced 2025-04-24 18:02:15 +00:00
Fix tests for gobin on Windows
This commit is contained in:
parent
fecd8b0af8
commit
0dbc2e7f12
1 changed files with 4 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
import * as gobin from '../src/gobin';
|
||||
import * as path from 'path';
|
||||
|
||||
jest.mock('child_process');
|
||||
|
||||
|
@ -6,16 +7,17 @@ describe('gobin', () => {
|
|||
const childProcess = require('child_process');
|
||||
|
||||
let execSpy: jest.SpyInstance;
|
||||
let gopath = path.join('home', 'user', 'go');
|
||||
|
||||
beforeEach(() => {
|
||||
execSpy = jest.spyOn(childProcess, 'exec');
|
||||
execSpy.mockImplementation((_command, callback) => {
|
||||
callback('', {stdout: '/home/user/go', stderr: ''});
|
||||
callback('', {stdout: gopath, stderr: ''});
|
||||
});
|
||||
});
|
||||
|
||||
it('should return ${GOPATH}/bin', async () => {
|
||||
const gobinPath = await gobin.getGOBIN('...');
|
||||
expect(gobinPath).toBe('/home/user/go/bin');
|
||||
expect(gobinPath).toBe(path.join(gopath, 'bin'));
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue