Skip to content

test(core): add unit tests for /provider command handlers#2157

Merged
bug-ops merged 1 commit intomainfrom
feat-issue-2152-add-unit-tests-for-provider
Mar 23, 2026
Merged

test(core): add unit tests for /provider command handlers#2157
bug-ops merged 1 commit intomainfrom
feat-issue-2152-add-unit-tests-for-provider

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Mar 23, 2026

Closes #2152

Summary

  • Added 9 unit tests in crates/zeph-core/src/agent/provider_cmd.rs covering all /provider command handlers
  • Tests use existing MockProvider/MockChannel/QuickTestAgent patterns from crates/zeph-core/src/agent/tests.rs

Tests added

Test Coverage
provider_list_empty_pool empty pool returns "No providers configured"
provider_list_shows_all_with_active_marker all entries appear in list
provider_list_marks_active_provider active provider gets (active) marker
provider_switch_unknown_name_returns_error unknown name returns error with available names
provider_switch_already_active_warns switching to current provider warns
provider_switch_missing_snapshot_returns_error missing snapshot returns error
provider_switch_success_resets_state switch resets cached_prompt_tokens, updates model
provider_status_no_metrics status output contains provider name and model
provider_config_snapshot_fields ProviderConfigSnapshot field construction

Test plan

  • cargo nextest run -p zeph-core --lib — 9/9 new tests pass
  • cargo clippy --workspace -- -D warnings — zero warnings
  • cargo +nightly fmt --check — no formatting issues

@github-actions github-actions bot added tests Test-related changes size/M Medium PR (51-200 lines) documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate and removed tests Test-related changes size/M Medium PR (51-200 lines) labels Mar 23, 2026
Nine tests covering list output, active-provider marking, valid switch
with state reset, unknown-name error, already-active warning, missing
snapshot error, status output, and ProviderConfigSnapshot construction.
@bug-ops bug-ops force-pushed the feat-issue-2152-add-unit-tests-for-provider branch from 015c28b to 986b119 Compare March 23, 2026 07:21
@github-actions github-actions bot added tests Test-related changes size/M Medium PR (51-200 lines) labels Mar 23, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 23, 2026 07:21
@bug-ops bug-ops merged commit f48c543 into main Mar 23, 2026
25 checks passed
@bug-ops bug-ops deleted the feat-issue-2152-add-unit-tests-for-provider branch March 23, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate documentation Improvements or additions to documentation rust Rust code changes size/M Medium PR (51-200 lines) tests Test-related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: add unit tests for /provider command handlers in provider_cmd.rs

1 participant