fix(tests): add BDD scenarios for rich/color formats with list data to restore coverage
CI / push-validation (pull_request) Successful in 24s
CI / helm (pull_request) Successful in 32s
CI / lint (pull_request) Successful in 45s
CI / build (pull_request) Successful in 41s
CI / quality (pull_request) Successful in 53s
CI / typecheck (pull_request) Successful in 58s
CI / security (pull_request) Successful in 1m21s
CI / unit_tests (pull_request) Successful in 4m51s
CI / docker (pull_request) Successful in 1m25s
CI / coverage (pull_request) Successful in 11m12s
CI / integration_tests (pull_request) Successful in 26m11s
CI / status-check (pull_request) Successful in 3s
CI / push-validation (pull_request) Successful in 24s
CI / helm (pull_request) Successful in 32s
CI / lint (pull_request) Successful in 45s
CI / build (pull_request) Successful in 41s
CI / quality (pull_request) Successful in 53s
CI / typecheck (pull_request) Successful in 58s
CI / security (pull_request) Successful in 1m21s
CI / unit_tests (pull_request) Successful in 4m51s
CI / docker (pull_request) Successful in 1m25s
CI / coverage (pull_request) Successful in 11m12s
CI / integration_tests (pull_request) Successful in 26m11s
CI / status-check (pull_request) Successful in 3s
Cover the list branches in _format_rich() and _format_color() that were left untested, causing the coverage gate to drop below the 97% threshold. Add two new @when steps (list+rich, list+color), two @then steps for list panel assertions, and two new feature scenarios exercising those paths. ISSUES CLOSED: #2921
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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}"
|
||||
)
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user