Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 4 commits intomasterfromfixes
Jun 20, 2020
Merged
Changes from1 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
NextNext commit
setup arg tests
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
@ShMcK
ShMcK committedJun 20, 2020
commit8af064c9a4c719a2c0a75eceef494282c00e3caa
42 changes: 42 additions & 0 deletionstests/args.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff 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);
});
});

[8]ページ先頭

©2009-2025 Movatter.jp