test: Add unit testing
This commit is contained in:
parent
92ff9cca3e
commit
c4e1e715b8
3 changed files with 4 additions and 8 deletions
|
|
@ -57,7 +57,6 @@ describe('getLatestVersion()', () => {
|
||||||
.get(`/api/formula/${Tool.Repo}.json`)
|
.get(`/api/formula/${Tool.Repo}.json`)
|
||||||
.reply(404);
|
.reply(404);
|
||||||
|
|
||||||
// const versionLatest = await getLatestVersion(Tool.Org, Tool.Repo, 'brew');
|
|
||||||
await expect(
|
await expect(
|
||||||
getLatestVersion(Tool.Org, Tool.Repo, 'brew')
|
getLatestVersion(Tool.Org, Tool.Repo, 'brew')
|
||||||
).rejects.toThrowError(FetchError);
|
).rejects.toThrowError(FetchError);
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,8 @@ describe('showVersion()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('return not found', async () => {
|
test('return not found', async () => {
|
||||||
result = await main.showVersion('gitgit', ['--version']);
|
await expect(
|
||||||
expect(result.exitcode).not.toBe(0);
|
main.showVersion('gitgit', ['--version'])
|
||||||
|
).rejects.toThrowError(Error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,7 @@ export async function showVersion(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
result.exitcode = await exec.exec(cmd, args, options);
|
||||||
result.exitcode = await exec.exec(cmd, args, options);
|
|
||||||
} catch (e) {
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
core.debug(`command: ${cmd} ${args}`);
|
core.debug(`command: ${cmd} ${args}`);
|
||||||
core.debug(`exit code: ${result.exitcode}`);
|
core.debug(`exit code: ${result.exitcode}`);
|
||||||
core.debug(`stdout: ${result.output}`);
|
core.debug(`stdout: ${result.output}`);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue