fix the settings tests

This commit is contained in:
Tamo 2024-03-12 18:19:02 +01:00
parent d1db495119
commit b72495eb58
2 changed files with 9 additions and 5 deletions

View File

@ -138,6 +138,7 @@ macro_rules! make_setting_route {
debug!(returns = ?settings, "Update settings"); debug!(returns = ?settings, "Update settings");
let mut json = serde_json::json!(&settings); let mut json = serde_json::json!(&settings);
dbg!(&json);
let val = json[$camelcase_attr].take(); let val = json[$camelcase_attr].take();
Ok(HttpResponse::Ok().json(val)) Ok(HttpResponse::Ok().json(val))
@ -625,14 +626,14 @@ fn embedder_analytics(
} }
make_setting_route!( make_setting_route!(
"/search_cutoff", "/search-cutoff",
patch, put,
u64, u64,
meilisearch_types::deserr::DeserrJsonError< meilisearch_types::deserr::DeserrJsonError<
meilisearch_types::error::deserr_codes::InvalidSettingsSearchCutoff, meilisearch_types::error::deserr_codes::InvalidSettingsSearchCutoff,
>, >,
search_cutoff, search_cutoff,
"search_cutoff", "searchCutoff",
analytics, analytics,
|setting: &Option<u64>, req: &HttpRequest| { |setting: &Option<u64>, req: &HttpRequest| {
analytics.publish( analytics.publish(
@ -673,7 +674,8 @@ generate_configure!(
typo_tolerance, typo_tolerance,
pagination, pagination,
faceting, faceting,
embedders embedders,
search_cutoff
); );
pub async fn update_all( pub async fn update_all(

View File

@ -35,6 +35,7 @@ static DEFAULT_SETTINGS_VALUES: Lazy<HashMap<&'static str, Value>> = Lazy::new(|
"maxTotalHits": json!(1000), "maxTotalHits": json!(1000),
}), }),
); );
map.insert("search_cutoff", json!(null));
map map
}); });
@ -286,7 +287,8 @@ test_setting_routes!(
ranking_rules put, ranking_rules put,
synonyms put, synonyms put,
pagination patch, pagination patch,
faceting patch faceting patch,
search_cutoff put
); );
#[actix_rt::test] #[actix_rt::test]