From 698bcf1774bf82ead4b08f5b6817b102ca69d7c3 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 27 Aug 2026 04:16:40 +0000 Subject: [PATCH 1/2] test: add missing tests for blocklist configuration Add `search_config_builder_methods_populate_fields` to `src/lib.rs` tests to ensure that `with_blocklist` correctly populates the builder configuration. Tests were also added for other missing builder methods like `with_allowlist`, `with_timeout`, and `with_cache` for completeness. Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com> --- src/lib.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index c9b6ecd..2ab425a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1054,6 +1054,25 @@ mod tests { Ok(()) } + #[test] + fn search_config_builder_methods_populate_fields() { + let config = SearchConfig::new("https://example.com") + .unwrap() + .with_blocklist(["badsite.com", "spam.org"]) + .with_allowlist(["goodsite.com"]) + .with_timeout(std::time::Duration::from_secs(10)) + .with_cache(100, std::time::Duration::from_secs(300)); + + assert_eq!( + config.blocklist, + vec!["badsite.com".to_owned(), "spam.org".to_owned()] + ); + assert_eq!(config.allowlist, vec!["goodsite.com".to_owned()]); + assert_eq!(config.timeout, std::time::Duration::from_secs(10)); + assert_eq!(config.cache_capacity, 100); + assert_eq!(config.cache_ttl, std::time::Duration::from_secs(300)); + } + #[test] fn search_config_from_url_validates_scheme_and_credentials() -> Result<(), url::ParseError> { // Valid URLs From 769773785e1198423455c17f2d8a2f1c46f20c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20Carter=20=E7=A5=81=E6=98=8E=E6=80=9D?= Date: Fri, 11 Sep 2026 11:28:43 +0800 Subject: [PATCH 2/2] fix: use tuple cache key in clear_cache test Cache keys are (embedded, mode, query) after the collision fix; the clear_cache unit test still inserted a bare String and failed to compile. --- src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 2ab425a..a0ebf04 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1352,7 +1352,10 @@ mod tests { filters: SearchFilters::default(), }; - client.cache.insert("rust".to_owned(), dummy_response); + client.cache.insert( + (false, SearchMode::Balanced, "rust".to_owned()), + dummy_response, + ); assert_eq!(client.cached_entries(), 1); client.clear_cache();