mirror of
https://github.com/codecov/codecov-action.git
synced 2026-02-10 04:57:24 +00:00
fix: write test for setSafeDirectory
This commit is contained in:
parent
eb61afa559
commit
e9d7aea5fc
1 changed files with 18 additions and 2 deletions
|
|
@ -1,10 +1,13 @@
|
||||||
|
import * as exec from '@actions/exec';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
PLATFORMS,
|
||||||
getBaseUrl,
|
getBaseUrl,
|
||||||
|
getCommand,
|
||||||
getPlatform,
|
getPlatform,
|
||||||
isValidPlatform,
|
isValidPlatform,
|
||||||
isWindows,
|
isWindows,
|
||||||
PLATFORMS,
|
setSafeDirectory,
|
||||||
getCommand,
|
|
||||||
} from './helpers';
|
} from './helpers';
|
||||||
|
|
||||||
let OLDOS = process.env.RUNNER_OS;
|
let OLDOS = process.env.RUNNER_OS;
|
||||||
|
|
@ -78,3 +81,16 @@ test('getCommand', () => {
|
||||||
expect(getCommand('path', ['-v', '-x'], 'do-upload'))
|
expect(getCommand('path', ['-v', '-x'], 'do-upload'))
|
||||||
.toEqual(['path', '-v', '-x', 'do-upload']);
|
.toEqual(['path', '-v', '-x', 'do-upload']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('setSafeDirectory', async () => {
|
||||||
|
process.env.GITHUB_WORKSPACE = 'testOrg/testRepo';
|
||||||
|
await setSafeDirectory();
|
||||||
|
const testSafeDirectory = ([
|
||||||
|
'git',
|
||||||
|
'config',
|
||||||
|
'--get',
|
||||||
|
'safe.directory',
|
||||||
|
]).join(' ');
|
||||||
|
const safeDirectory = await exec.getExecOutput(testSafeDirectory);
|
||||||
|
expect(safeDirectory.stdout).toBe('testOrg/testRepo\n');
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue