Files
cleveragents-core/features/context_unit_tests.feature
T

100 lines
3.6 KiB
Gherkin

Feature: Context Commands Unit Tests
As a developer
I want unit tests for context command functionality
So that context.py achieves high code coverage
@phase1
Scenario: Context add command full execution path
Given a mock context service is configured
When the context add command is executed with valid paths
Then files should be added successfully with output
@phase1
Scenario: Context add with non-existent path error
Given a mock context service is configured
When the context add command is executed with non-existent path
Then path does not exist error should be shown
@phase1
Scenario: Context add with FileSystemError exception
Given a mock context service that raises FileSystemError
When the context add command is executed and fails
Then FileSystemError should be displayed and command aborted
@phase1
Scenario: Context add with CleverAgentsError exception
Given a mock context service that raises CleverAgentsError
When the context add command is executed and fails
Then CleverAgentsError should be displayed and command aborted
@phase1
Scenario: Context load alias command
Given a mock context service is configured
When the context load alias is executed
Then it should delegate to context add function
@phase1
Scenario: Context remove command execution
Given a mock context service with remove capability
When the context remove command is executed
Then files should be removed with confirmation message
@phase1
Scenario: Context remove with no files removed
Given a mock context service returning zero removals
When the context remove command is executed
Then no files removed message should be shown
@phase1
Scenario: Context list with files present
Given a mock context service with files
When the context list command is executed
Then a formatted table of files should be displayed
@phase1
Scenario: Context list with empty context
Given a mock context service with no files
When the context list command is executed
Then empty context message should be shown with help
@phase1
Scenario: Context show specific file
Given a mock context service with file content
When the context show command is executed with path
Then file content should be displayed in panel
@phase1
Scenario: Context show file not found
Given a mock context service returning no content
When the context show command is executed with path
Then file not found message should be displayed
@phase1
Scenario: Context show all summary
Given a mock context service with multiple files
When the context show command is executed without path
Then context summary with stats should be displayed
@phase1
Scenario: Context clear with confirmation
Given a mock context service with clearable files
When the context clear command is executed with yes flag
Then context should be cleared with success message
@phase1
Scenario: Context clear cancelled by user
Given a mock context service with clearable files
When the context clear command is executed and user cancels
Then cancelled message should appear and context unchanged
@phase1
Scenario: Context clear on already empty
Given a mock context service with no files
When the context clear command is executed
Then already empty message should be shown
@phase1
Scenario: Context default callback behavior
Given a mock context service with files
When context command is invoked without subcommand
Then the list function should be called by default