diff --git a/features/cli_output_formats.feature b/features/cli_output_formats.feature index 5a206492f..f8eb425b4 100644 --- a/features/cli_output_formats.feature +++ b/features/cli_output_formats.feature @@ -118,6 +118,16 @@ Feature: CLI output formats parity When I call format_output with a list and format plain Then the format result should contain separator lines + Scenario: Format output rich format handles list data + When I call format_output with a list and format rich + Then the format result should contain rich styled list output + And the format result should not be valid JSON + + Scenario: Format output color format handles list data + When I call format_output with a list and format color + Then the format result should contain color styled list output + And the format result should not be plain text only + Scenario: Serialize value handles enums and nested dicts When I call serialize_value with enum and nested data Then the serialized result should have string enum values diff --git a/features/steps/cli_output_format_validation_steps.py b/features/steps/cli_output_format_validation_steps.py index a046f49eb..7ed3726ee 100644 --- a/features/steps/cli_output_format_validation_steps.py +++ b/features/steps/cli_output_format_validation_steps.py @@ -125,3 +125,27 @@ def step_format_result_not_plain_text(context: Context) -> None: f"format_output() with 'color' returned plain text — " f"expected ANSI-colored output, got: {result!r}" ) + + +@then("the format result should contain rich styled list output") +def step_format_result_rich_list(context: Context) -> None: + """Assert rich format produces styled output for list data (panel per item).""" + result = context.format_result + assert "name" in result, f"Rich list output missing 'name': {result!r}" + has_ansi = "\033[" in result or "\x1b[" in result + has_item_panel = "Item 1" in result or "Item 2" in result + assert has_ansi or has_item_panel, ( + f"Rich list output has no ANSI codes or item panels — got: {result!r}" + ) + + +@then("the format result should contain color styled list output") +def step_format_result_color_list(context: Context) -> None: + """Assert color format produces styled output for list data (panel per item).""" + result = context.format_result + assert "name" in result, f"Color list output missing 'name': {result!r}" + has_ansi = "\033[" in result or "\x1b[" in result + has_item_panel = "Item 1" in result or "Item 2" in result + assert has_ansi or has_item_panel, ( + f"Color list output has no ANSI codes or item panels — got: {result!r}" + ) diff --git a/features/steps/cli_output_formats_steps.py b/features/steps/cli_output_formats_steps.py index 1f3fdce2f..5c8b194b8 100644 --- a/features/steps/cli_output_formats_steps.py +++ b/features/steps/cli_output_formats_steps.py @@ -456,6 +456,24 @@ def step_call_format_list_plain(context: Context) -> None: context.format_result = _capture_format_output(data, "plain") +@when("I call format_output with a list and format rich") +def step_call_format_list_rich(context: Context) -> None: + data = [ + {"name": "a", "count": 1}, + {"name": "b", "count": 2}, + ] + context.format_result = _capture_format_output(data, "rich") + + +@when("I call format_output with a list and format color") +def step_call_format_list_color(context: Context) -> None: + data = [ + {"name": "a", "count": 1}, + {"name": "b", "count": 2}, + ] + context.format_result = _capture_format_output(data, "color") + + @when("I call serialize_value with enum and nested data") def step_call_serialize_with_enum(context: Context) -> None: context.serialized = _serialize_value(