t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/Cli/PlainCliFormatter.test.ts
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

51 lines
1.6 KiB
TypeScript

import { plainCliFormatter } from "@/Cli/PlainCliFormatter.ts";
import * as Context from "effect/Context";
import * as Option from "effect/Option";
import { expect, it } from "alchemy-test";
it(
"compacts enum flag types and bounds every line",
() => {
const output = plainCliFormatter({ columns: 80 }).formatHelpDoc({
description:
"Define, deploy, and operate cloud infrastructure with type-safe Effect programs. " +
"This description is deliberately long enough that the default formatter would " +
"emit a line wider than eighty columns without wrapping.",
usage: "alchemy <subcommand> [flags]",
annotations: Context.empty(),
flags: [],
globalFlags: [
{
name: "log-level",
aliases: [],
type: "all|trace|debug|info|warn|warning|error|fatal|none",
description: Option.some(
"Sets the minimum log level for every command and provider.",
),
required: false,
},
],
subcommands: [
{
group: undefined,
commands: [
{
name: "deploy",
alias: undefined,
shortDescription: "Deploy a stack",
description: "Deploy a stack",
},
],
},
],
examples: [{ command: "alchemy deploy" }],
});
// The nine-choice enum must not widen the flag column.
expect(output).toContain("--log-level all|trace|…");
for (const line of output.split("\n")) {
expect(line.length <= 80).toBe(true);
}
},
{ tags: ["unit", "local"] },
);