test: add unit test coverage for zero-test files across tools and util#3739
Open
sandikodev wants to merge 7 commits intoaws:mainfrom
Open
test: add unit test coverage for zero-test files across tools and util#3739sandikodev wants to merge 7 commits intoaws:mainfrom
sandikodev wants to merge 7 commits intoaws:mainfrom
Conversation
…and deserialization todo.rs had zero tests. Add coverage for: - has_duplicates: empty, unique, and duplicate cases - generate_new_todo_id: uniqueness (with sleep) and numeric format - TodoList deserialization: Create, Complete, Add, Remove variants
Add three additional tests covering: - absolute path passes through unchanged - empty string does not panic - tilde only expands at the start of a path, not in the middle
…tion custom_tool.rs: - default_timeout is 120_000ms (2 minutes) - get_default_scopes returns non-empty strings - TransportType::default() is Stdio knowledge.rs: - TodoList deserialization for Add, Search, Remove, Clear variants
thinking.rs (was 0 tests): - deserialization - invoke returns empty output - validate accepts both empty and non-empty thoughts introspect.rs (was 0 tests): - deserialization with and without query - validate always succeeds
…zation delegate.rs had only 1 test (get_schema). Add coverage for: - truncate_description: period truncation, long string, short string - format_launch_success: contains agent name and task - AgentStatus::default is Running - Delegate deserialization: Launch with task, Status without agent - resolve_agent_name fallback chain (explicit > configured > default)
…_path paths.rs had zero tests. Add coverage for: - add_gitignore_globs: matches file and children, trailing slash, invalid pattern error - canonicalizes_path: absolute path, dotdot resolution
env_var.rs had zero tests. Add coverage for: - get_mock_chat_response: present and absent - is_sigv4_enabled: with value, empty value, absent - get_editor: returns non-empty string Uses Env::from_slice (the correct test pattern) instead of std::env::set_var since Env::new() in test mode uses a Fake backend that ignores real env vars.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Several files had zero or minimal tests despite containing non-trivial logic. This PR systematically adds unit test coverage for functions that can be tested without a full
OsorChatSessioninstance.Files covered
tools/delegate.rstools/todo.rstools/thinking.rstools/introspect.rstools/custom_tool.rstools/knowledge.rstools/mod.rsutil/paths.rsWhat is tested
truncate_description,format_launch_success,has_duplicates,generate_new_todo_id,default_timeout,add_gitignore_globs,canonicalizes_pathAgentStatus::default,TransportType::defaultTesting
cargo test -p chat_cli381 passed, 0 failed (up from 328 before this PR).
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.