Files
cleveragents-core/features/cli_renderers_coverage.feature

99 lines
4.4 KiB
Gherkin

@mock_only
Feature: CLI renderers coverage
Verifies render_error, render_success, render_warning, and render_empty
helper functions across all output formats (rich, json, plain).
# --- render_error ---
Scenario: render_error with rich format shows red label
Given a captured console for renderers
When I call render_error with label "NOT_FOUND" message "Item missing" fmt "rich"
Then the renderer output should contain "NOT_FOUND"
And the renderer output should contain "Item missing"
Scenario: render_error with json format produces JSON envelope
Given a captured console for renderers
When I call render_error with label "NOT_FOUND" message "Item missing" fmt "json"
Then the renderer output should contain "NOT_FOUND"
Scenario: render_error with plain format shows ERROR prefix
Given a captured console for renderers
When I call render_error with label "NOT_FOUND" message "Item missing" fmt "plain"
Then the renderer output should contain "ERROR: NOT_FOUND: Item missing"
Scenario: render_error with recovery hint in rich format
Given a captured console for renderers
And a recovery hint "Try 'list' first"
When I call render_error with label "NOT_FOUND" message "Item missing" fmt "rich"
Then the renderer output should contain "Try 'list' first"
Scenario: render_error with recovery hint in plain format
Given a captured console for renderers
And a recovery hint "Try 'list' first"
When I call render_error with label "NOT_FOUND" message "Item missing" fmt "plain"
Then the renderer output should contain "Try 'list' first"
# --- render_success ---
Scenario: render_success with rich format shows green check
Given a captured console for renderers
When I call render_success with message "Created project" fmt "rich"
Then the renderer output should contain "Created project"
Scenario: render_success with json format produces JSON
Given a captured console for renderers
When I call render_success with message "Created project" fmt "json"
Then the renderer output should contain "ok"
Scenario: render_success with plain format shows OK prefix
Given a captured console for renderers
When I call render_success with message "Created project" fmt "plain"
Then the renderer output should contain "OK: Created project"
# --- render_warning ---
Scenario: render_warning with rich format shows yellow text
Given a captured console for renderers
When I call render_warning with message "Deprecated feature" fmt "rich"
Then the renderer output should contain "Deprecated feature"
Scenario: render_warning with json format produces JSON
Given a captured console for renderers
When I call render_warning with message "Deprecated feature" fmt "json"
Then the renderer output should contain "warning"
Scenario: render_warning with plain format shows WARNING prefix
Given a captured console for renderers
When I call render_warning with message "Deprecated feature" fmt "plain"
Then the renderer output should contain "WARNING: Deprecated feature"
# --- render_empty ---
Scenario: render_empty with rich format shows yellow message
Given a captured console for renderers
When I call render_empty with entity_type "actions" fmt "rich"
Then the renderer output should contain "No actions found"
Scenario: render_empty with json format produces empty list
Given a captured console for renderers
When I call render_empty with entity_type "actions" fmt "json"
Then the renderer output should contain "[]"
Scenario: render_empty with plain format shows text
Given a captured console for renderers
When I call render_empty with entity_type "actions" fmt "plain"
Then the renderer output should contain "No actions found."
Scenario: render_empty with recovery hint in rich format
Given a captured console for renderers
And a recovery hint "Run 'action create' first"
When I call render_empty with entity_type "actions" fmt "rich"
Then the renderer output should contain "Run 'action create' first"
Scenario: render_empty with table format and recovery
Given a captured console for renderers
And a recovery hint "Run 'project create' first"
When I call render_empty with entity_type "projects" fmt "table"
Then the renderer output should contain "No projects found."
And the renderer output should contain "Run 'project create' first"