mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-27 16:51:01 +00:00
add tests for min_word_len_for_typo
This commit is contained in:
@ -937,6 +937,7 @@ pub(crate) mod tests {
|
||||
use maplit::btreemap;
|
||||
use tempfile::TempDir;
|
||||
|
||||
use crate::index::{DEFAULT_MIN_WORD_LEN_1_TYPO, DEFAULT_MIN_WORD_LEN_2_TYPOS};
|
||||
use crate::update::{IndexDocuments, IndexDocumentsConfig, IndexerConfig};
|
||||
use crate::Index;
|
||||
|
||||
@ -1064,4 +1065,22 @@ pub(crate) mod tests {
|
||||
let txn = index.read_txn().unwrap();
|
||||
assert!(!index.authorize_typos(&txn).unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_min_word_len_for_typos() {
|
||||
let index = TempIndex::new();
|
||||
let mut txn = index.write_txn().unwrap();
|
||||
|
||||
assert_eq!(index.min_word_len_1_typo(&txn).unwrap(), DEFAULT_MIN_WORD_LEN_1_TYPO);
|
||||
assert_eq!(index.min_word_len_2_typo(&txn).unwrap(), DEFAULT_MIN_WORD_LEN_2_TYPOS);
|
||||
|
||||
index.put_min_word_len_1_typo(&mut txn, 3).unwrap();
|
||||
index.put_min_word_len_2_typo(&mut txn, 15).unwrap();
|
||||
|
||||
txn.commit().unwrap();
|
||||
|
||||
let txn = index.read_txn().unwrap();
|
||||
assert_eq!(index.min_word_len_1_typo(&txn).unwrap(), 3);
|
||||
assert_eq!(index.min_word_len_2_typo(&txn).unwrap(), 15);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user