test: deduplicate cli option collision fixtures

This commit is contained in:
Peter Steinberger
2026-03-10 20:34:54 +00:00
parent 283570de4d
commit 158a3b49a7
6 changed files with 201 additions and 180 deletions

View File

@@ -44,30 +44,36 @@ describe("update cli option collisions", () => {
defaultRuntime.exit.mockClear();
});
it("forwards parent-captured --json/--timeout to `update status`", async () => {
await runRegisteredCli({
register: registerUpdateCli as (program: Command) => void,
it.each([
{
name: "forwards parent-captured --json/--timeout to `update status`",
argv: ["update", "status", "--json", "--timeout", "9"],
});
expect(updateStatusCommand).toHaveBeenCalledWith(
expect.objectContaining({
json: true,
timeout: "9",
}),
);
});
it("forwards parent-captured --timeout to `update wizard`", async () => {
assert: () => {
expect(updateStatusCommand).toHaveBeenCalledWith(
expect.objectContaining({
json: true,
timeout: "9",
}),
);
},
},
{
name: "forwards parent-captured --timeout to `update wizard`",
argv: ["update", "wizard", "--timeout", "13"],
assert: () => {
expect(updateWizardCommand).toHaveBeenCalledWith(
expect.objectContaining({
timeout: "13",
}),
);
},
},
])("$name", async ({ argv, assert }) => {
await runRegisteredCli({
register: registerUpdateCli as (program: Command) => void,
argv: ["update", "wizard", "--timeout", "13"],
argv,
});
expect(updateWizardCommand).toHaveBeenCalledWith(
expect.objectContaining({
timeout: "13",
}),
);
assert();
});
});