test: coverage for indexes list and get_none_if_not_found#62
test: coverage for indexes list and get_none_if_not_found#62eddietejeda merged 1 commit intomainfrom
Conversation
Add ApiClient::test_new for mock HTTP tests. Cover get_none_if_not_found 404 and 200 paths with mockito. Extract information_schema_followup, connection_label_to_id_map, and sort_info_tables for unit tests plus mocked collect_tables and list_one_table scan paths. Connection map now stores display name to id only; catalog rows that already carry a connection id still resolve via the existing fallback.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
| } | ||
|
|
||
| #[test] | ||
| fn sort_info_tables_orders_by_connection_schema_table() { |
There was a problem hiding this comment.
nit: The test only exercises connection-level ordering (entries differ at connection). Schema and table tiebreaking are never reached, so the test name oversells the coverage. Consider adding a second pair that shares the same connection but differs on schema or table to actually verify the composite key. (not blocking)
| } | ||
|
|
||
| #[test] | ||
| fn list_one_table_scan_returns_indexes_on_200() { |
There was a problem hiding this comment.
super nit: Unlike the other mockito tests in this file, this one doesn't call .match_header("Authorization", "Bearer k"), so the header is not verified. Consistent header matching would make the test stronger. (not blocking)
Summary
Adds unit and mockito-backed tests to improve Codecov on the workspace indexes list flow and
ApiClient::get_none_if_not_found.Changes
ApiClient::test_new(#[cfg(test)]): construct a client against a mock server without loading profile config.api: tests forget_none_if_not_foundon 404 (returnsNone) and 200 (parses JSON), includingX-Workspace-Idwhen a workspace is set.indexes: extractinformation_schema_followup,connection_label_to_id_map, andsort_info_tablesfor focused tests; mockcollect_tables,list_one_table, andlist_one_table_scan.has_moreis true butnext_cursoris missing; connection lookup maps display name → id only (catalog values that are already connection IDs still work via the existing fallback).Testing
cargo test(all tests pass).