Skip to content

Commit 217c60a

Browse files
refactor(index): tidy constant and test
1 parent 339df24 commit 217c60a

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ const cliVersion = '1.2.3';
2525
const pathToTarball = 'path/to/tarball';
2626
const pathToCLI = 'path/to/cli';
2727

28-
describe.each(['darwin', 'win32', 'linux'])('when OS is %p', (os) => {
28+
describe.each(['darwin', 'win32', 'linux'])('when os is %p', (platform) => {
2929
beforeEach(() => {
30-
mockedOs.platform.mockReturnValue(os as NodeJS.Platform);
31-
mockedOs.arch.mockReturnValue('arm64');
30+
mockedOs.platform.mockReturnValue(platform as NodeJS.Platform);
31+
mockedOs.arch.mockReturnValue('arm64' as NodeJS.Architecture);
3232

3333
mockedCore.getInput.mockImplementation((input) => {
3434
switch (input) {
@@ -44,7 +44,7 @@ describe.each(['darwin', 'win32', 'linux'])('when OS is %p', (os) => {
4444

4545
it('downloads, extracts, and adds CLI to PATH', async () => {
4646
mockedTc.downloadTool.mockResolvedValueOnce(pathToTarball);
47-
const isWin32 = os === 'win32';
47+
const isWin32 = platform === 'win32';
4848
const extract = isWin32 ? mockedTc.extractZip : mockedTc.extractTar;
4949
extract.mockResolvedValueOnce(pathToCLI);
5050

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ import {
1212

1313
import { getBinaryPath, getDownloadObject } from './utils';
1414

15-
const DEFAULT_NAME = 'gh';
15+
const TOOL_NAME = 'gh';
1616

1717
export async function run() {
1818
try {
1919
// Get the version and name of the tool to be installed
2020
const cliVersion = getInput('cli-version');
21-
const cliName = getInput('cli-name') || DEFAULT_NAME;
21+
const cliName = getInput('cli-name');
2222
const filename = getBinaryPath('', cliName);
2323

2424
// Find previously cached directory (if applicable)
@@ -44,9 +44,9 @@ export async function run() {
4444

4545
// Rename the binary
4646
/* istanbul ignore else */
47-
if (cliName !== DEFAULT_NAME) {
47+
if (cliName !== TOOL_NAME) {
4848
await exec('mv', [
49-
getBinaryPath(binaryDirectory, DEFAULT_NAME),
49+
getBinaryPath(binaryDirectory, TOOL_NAME),
5050
binaryPath,
5151
]);
5252
}

0 commit comments

Comments
 (0)