Skip to content

Add "clean" = false option #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 20, 2020
Merged
Changes from 1 commit
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
Next Next commit
setup arg tests
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Jun 20, 2020
commit 8af064c9a4c719a2c0a75eceef494282c00e3caa
42 changes: 42 additions & 0 deletions tests/args.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { getArg } from "../src/utils/args";

describe("args", () => {
it("should capture an arg name from text", () => {
const args = ["--name", "value"];
const result = getArg(args, { name: "name" });
expect(result).toBe("value");
});
it("should capture an arg alias from text", () => {
const args = ["-n", "value"];
const result = getArg(args, { name: "name", alias: "n" });
expect(result).toBe("value");
});
it("should capture an arg name from text when starting values", () => {
const args = ["dir", "--name", "value"];
const result = getArg(args, { name: "name" });
expect(result).toBe("value");
});
it("should capture an arg alias from text", () => {
const args = ["dir", "-n", "value"];
const result = getArg(args, { name: "name", alias: "n" });
expect(result).toBe("value");
});
it("should default value to true if no next value", () => {
const args = ["--someBool"];
const result = getArg(args, {
name: "someBool",
alias: "sb",
type: "bool",
});
expect(result).toBe(true);
});
it("should default value to true if next value is param", () => {
const args = ["--someBool", "--someOtherBool"];
const result = getArg(args, {
name: "someBool",
alias: "sb",
type: "bool",
});
expect(result).toBe(true);
});
});