forked from HAL9000/cleveragents-core
100 lines
4.8 KiB
Gherkin
100 lines
4.8 KiB
Gherkin
Feature: Action CLI edge cases coverage
|
|
As a developer
|
|
I want to test edge cases and fallback paths in the action CLI
|
|
So that all branches are thoroughly exercised
|
|
|
|
Background:
|
|
Given an action edge case CLI runner
|
|
And an action edge case mocked lifecycle service
|
|
|
|
# _print_action edge cases
|
|
Scenario: Print action with no arguments shows none indicator
|
|
Given an action edge case action with no arguments
|
|
When I call action edge case print action
|
|
Then the action edge case output should contain "(none)"
|
|
|
|
Scenario: Print action with arguments shows formatted list
|
|
Given an action edge case action with multiple arguments
|
|
When I call action edge case print action
|
|
Then the action edge case output should contain argument "target_coverage"
|
|
And the action edge case output should contain argument "test_framework"
|
|
And the action edge case output should contain "Target coverage percentage"
|
|
|
|
Scenario: Print action without short_description omits description line
|
|
Given an action edge case action without short description
|
|
When I call action edge case print action
|
|
Then the action edge case output should not contain "Description:"
|
|
|
|
# Create command edge cases
|
|
Scenario: Create action with multiple argument definitions
|
|
When I run action edge case create with multiple args
|
|
Then the action edge case create should succeed
|
|
And the action edge case service should receive 2 arguments
|
|
|
|
Scenario: Create action with read-only flag
|
|
When I run action edge case create with read-only flag
|
|
Then the action edge case create should succeed
|
|
And the action edge case service should receive read_only true
|
|
|
|
Scenario: Create action with tags
|
|
When I run action edge case create with multiple tags
|
|
Then the action edge case create should succeed
|
|
And the action edge case service should receive tags "ci" and "coverage"
|
|
|
|
Scenario: Create action with long_description parameter
|
|
When I run action edge case create with long description
|
|
Then the action edge case create should succeed
|
|
And the action edge case service should receive long description "Detailed documentation text"
|
|
|
|
# List command with state filters
|
|
Scenario: List actions with state filter draft
|
|
Given there are action edge case existing actions
|
|
When I run action edge case list with state "draft"
|
|
Then the action edge case list should succeed
|
|
And the action edge case service list should be called with draft state
|
|
|
|
Scenario: List actions with state filter archived
|
|
Given there are action edge case existing actions
|
|
When I run action edge case list with state "archived"
|
|
Then the action edge case list should succeed
|
|
And the action edge case service list should be called with archived state
|
|
|
|
# Show command fallback paths
|
|
Scenario: Show action falls back to name lookup on NotFoundError
|
|
Given an action edge case that is only findable by name
|
|
When I run action edge case show with name "local/name-only-action"
|
|
Then the action edge case show should succeed
|
|
And the action edge case service should have tried get_action first
|
|
And the action edge case service should have fallen back to get_action_by_name
|
|
|
|
Scenario: Show action raises abort when both ID and name fail
|
|
Given an action edge case where both lookups fail
|
|
When I run action edge case show with name "nonexistent"
|
|
Then the action edge case show should abort with not found
|
|
|
|
# Available command fallback paths
|
|
Scenario: Available command falls back to name lookup
|
|
Given an action edge case draft action only findable by name
|
|
When I run action edge case available with name "local/name-only-draft"
|
|
Then the action edge case available should succeed
|
|
And the action edge case service should have tried get_action first
|
|
And the action edge case service should have fallen back to get_action_by_name
|
|
|
|
Scenario: Available command handles BusinessRuleViolation
|
|
Given an action edge case available action that violates business rule
|
|
When I run action edge case available with id "01ARZ3NDEKTSV4RRFFQ69G5FAV"
|
|
Then the action edge case available should abort with business rule message
|
|
|
|
# Archive command fallback paths
|
|
Scenario: Archive command falls back to name lookup
|
|
Given an action edge case available action only findable by name
|
|
When I run action edge case archive with name "local/name-only-available"
|
|
Then the action edge case archive should succeed
|
|
And the action edge case service should have tried get_action first
|
|
And the action edge case service should have fallen back to get_action_by_name
|
|
|
|
Scenario: Archive command not found aborts
|
|
Given an action edge case where both lookups fail for archive
|
|
When I run action edge case archive with name "nonexistent"
|
|
Then the action edge case archive should abort with not found
|