From 3e34981d9b29e11e02f549c582b015ffad097854 Mon Sep 17 00:00:00 2001 From: ad hoc Date: Thu, 31 Mar 2022 14:12:00 +0200 Subject: [PATCH] add test for authorize_typos in update --- milli/src/update/settings.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/milli/src/update/settings.rs b/milli/src/update/settings.rs index 25f3e92a3..17924da8a 100644 --- a/milli/src/update/settings.rs +++ b/milli/src/update/settings.rs @@ -518,6 +518,7 @@ mod tests { use super::*; use crate::error::Error; + use crate::index::tests::TempIndex; use crate::update::IndexDocuments; use crate::{Criterion, Filter, SearchResult}; @@ -1218,4 +1219,18 @@ mod tests { let line = std::str::from_utf8(content.get(fid).unwrap()).unwrap(); assert_eq!(line, r#""Star Wars""#); } + + #[test] + fn test_disable_typo() { + let index = TempIndex::new(); + + let mut txn = index.write_txn().unwrap(); + let config = IndexerConfig::default(); + + assert!(index.authorize_typos(&txn).unwrap()); + let mut builder = Settings::new(&mut txn, &index, &config); + builder.set_autorize_typos(false); + builder.execute(|_| ()).unwrap(); + assert!(!index.authorize_typos(&txn).unwrap()); + } }