mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 05:51:06 +00:00
test(cli): share timing flag fixture matrix (#16327)
This commit is contained in:
1 parent
387ddfebc2
commit
b635ff751e
1 file changed
+35
-55
@@ -4,6 +4,15 @@ import {
|
||||
parseCliGlobalArguments,
|
||||
} from "../../../src/cliBuiltinArguments.js";
|
||||
|
||||
const timingFlags = [
|
||||
["--timings", true],
|
||||
["--no-timings", false],
|
||||
["--timings=false", false],
|
||||
["--timings=true", true],
|
||||
["--timings=other", false],
|
||||
["--timings=", false],
|
||||
] as const;
|
||||
|
||||
// Observed with Incur 0.6.1 before removing the dependency.
|
||||
it.each([
|
||||
{
|
||||
@@ -11,36 +20,11 @@ it.each([
|
||||
rest: [],
|
||||
enabled: false,
|
||||
},
|
||||
{
|
||||
input: ["--timings"],
|
||||
...timingFlags.map(([flag, enabled]) => ({
|
||||
input: [flag],
|
||||
rest: [],
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
input: ["--no-timings"],
|
||||
rest: [],
|
||||
enabled: false,
|
||||
},
|
||||
{
|
||||
input: ["--timings=false"],
|
||||
rest: [],
|
||||
enabled: false,
|
||||
},
|
||||
{
|
||||
input: ["--timings=true"],
|
||||
rest: [],
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
input: ["--timings=other"],
|
||||
rest: [],
|
||||
enabled: false,
|
||||
},
|
||||
{
|
||||
input: ["--timings="],
|
||||
rest: [],
|
||||
enabled: false,
|
||||
},
|
||||
enabled,
|
||||
})),
|
||||
{
|
||||
input: ["--timings", "--no-timings"],
|
||||
rest: [],
|
||||
@@ -72,32 +56,28 @@ it.each([
|
||||
},
|
||||
);
|
||||
|
||||
it.each([
|
||||
"--timings",
|
||||
"--no-timings",
|
||||
"--timings=false",
|
||||
"--timings=true",
|
||||
"--timings=other",
|
||||
"--timings=",
|
||||
])("preserves output values and root alias with %s", (flag) => {
|
||||
expect(
|
||||
classifyCliEntrypoint(["mcp", "doctor", "--format", flag], {}),
|
||||
).toEqual({
|
||||
kind: "mcp-doctor",
|
||||
arguments: ["--format", flag],
|
||||
timings: false,
|
||||
});
|
||||
expect(
|
||||
parseCliGlobalArguments([flag, "--update", "--json"]).arguments,
|
||||
).toEqual(["update", flag, "--json"]);
|
||||
expect(
|
||||
parseCliGlobalArguments(["--update", flag, "--json"]).arguments,
|
||||
).toEqual(["update", flag, "--json"]);
|
||||
expect(parseCliGlobalArguments([flag, "mcp", "doctor"]).command).toEqual([
|
||||
"mcp",
|
||||
"doctor",
|
||||
]);
|
||||
});
|
||||
it.each(timingFlags.map(([flag]) => flag))(
|
||||
"preserves output values and root alias with %s",
|
||||
(flag) => {
|
||||
expect(
|
||||
classifyCliEntrypoint(["mcp", "doctor", "--format", flag], {}),
|
||||
).toEqual({
|
||||
kind: "mcp-doctor",
|
||||
arguments: ["--format", flag],
|
||||
timings: false,
|
||||
});
|
||||
expect(
|
||||
parseCliGlobalArguments([flag, "--update", "--json"]).arguments,
|
||||
).toEqual(["update", flag, "--json"]);
|
||||
expect(
|
||||
parseCliGlobalArguments(["--update", flag, "--json"]).arguments,
|
||||
).toEqual(["update", flag, "--json"]);
|
||||
expect(parseCliGlobalArguments([flag, "mcp", "doctor"]).command).toEqual([
|
||||
"mcp",
|
||||
"doctor",
|
||||
]);
|
||||
},
|
||||
);
|
||||
it("retains the separator and its following timing-shaped data", () => {
|
||||
expect(
|
||||
parseCliGlobalArguments(["--", "--update", "--timings=false"]).arguments,
|
||||
|
||||
Reference in new issue
Block a user