Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ resolve_version() {
;;
*)
echo "Error: unexpected response from GitHub releases API." >&2
echo "Response (truncated): $(printf '%s' "$response" | head -c 200)" >&2
echo "Response (truncated): $(printf '%s' "$response" | cut -c1-200)" >&2
exit 1
;;
esac
Expand Down
27 changes: 13 additions & 14 deletions tests/commands/plugin/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,31 @@ import { Command } from "@commander-js/extra-typings";

import { registerPluginCommand } from "../../../src/commands/plugin/index";

const createProgramAndPlugin = () => {
const program = new Command();
registerPluginCommand(program);
const plugin = program.commands.find((c) => c.name() === "plugin")!;
return { program, plugin };
};

describe("registerPluginCommand", () => {
test("registers 'plugin' as a subcommand", () => {
const program = new Command();
registerPluginCommand(program);
const sub = program.commands.find((c) => c.name() === "plugin");
expect(sub).toBeDefined();
const { plugin } = createProgramAndPlugin();
expect(plugin).toBeDefined();
});

test("has a description", () => {
const program = new Command();
registerPluginCommand(program);
const sub = program.commands.find((c) => c.name() === "plugin")!;
expect(sub.description()).toBeTruthy();
const { plugin } = createProgramAndPlugin();
expect(plugin.description()).toBeTruthy();
});

test("registers 'url' subcommand", () => {
const program = new Command();
registerPluginCommand(program);
const plugin = program.commands.find((c) => c.name() === "plugin")!;
const { plugin } = createProgramAndPlugin();
expect(plugin.commands.find((c) => c.name() === "url")).toBeDefined();
});

test("registers 'install' subcommand", () => {
const program = new Command();
registerPluginCommand(program);
const plugin = program.commands.find((c) => c.name() === "plugin")!;
const { plugin } = createProgramAndPlugin();
expect(plugin.commands.find((c) => c.name() === "install")).toBeDefined();
});
});
6 changes: 3 additions & 3 deletions tests/helpers/binary-upgrade.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ describe("getArtifactInfo", () => {
test("returns .tar.gz extension for non-win32", () => {
const info = getArtifactInfo();
if (process.platform === "win32") return;
if (info === null) return;
expect(info.ext).toBe(".tar.gz");
expect(info.binaryName).toBe("archgate");
expect(info).not.toBeNull();
expect(info!.ext).toBe(".tar.gz");
expect(info!.binaryName).toBe("archgate");
});
});

Expand Down
Loading