mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-30 08:44:27 +01:00
test: Improve the tests of the number of documents counting
This commit is contained in:
parent
2006259a23
commit
af26c39482
@ -33,6 +33,7 @@ fn insert_delete_document() {
|
|||||||
let status = index.update_status_blocking(update_id).unwrap();
|
let status = index.update_status_blocking(update_id).unwrap();
|
||||||
assert!(as_been_updated.swap(false, Relaxed));
|
assert!(as_been_updated.swap(false, Relaxed));
|
||||||
assert!(status.result.is_ok());
|
assert!(status.result.is_ok());
|
||||||
|
assert_eq!(index.number_of_documents(), 1);
|
||||||
|
|
||||||
let docs = index.query_builder().query("hello", 0..10).unwrap();
|
let docs = index.query_builder().query("hello", 0..10).unwrap();
|
||||||
assert_eq!(docs.len(), 1);
|
assert_eq!(docs.len(), 1);
|
||||||
@ -44,6 +45,7 @@ fn insert_delete_document() {
|
|||||||
let status = index.update_status_blocking(update_id).unwrap();
|
let status = index.update_status_blocking(update_id).unwrap();
|
||||||
assert!(as_been_updated.swap(false, Relaxed));
|
assert!(as_been_updated.swap(false, Relaxed));
|
||||||
assert!(status.result.is_ok());
|
assert!(status.result.is_ok());
|
||||||
|
assert_eq!(index.number_of_documents(), 0);
|
||||||
|
|
||||||
let docs = index.query_builder().query("hello", 0..10).unwrap();
|
let docs = index.query_builder().query("hello", 0..10).unwrap();
|
||||||
assert_eq!(docs.len(), 0);
|
assert_eq!(docs.len(), 0);
|
||||||
@ -71,17 +73,19 @@ fn replace_document() {
|
|||||||
let status = index.update_status_blocking(update_id).unwrap();
|
let status = index.update_status_blocking(update_id).unwrap();
|
||||||
assert!(as_been_updated.swap(false, Relaxed));
|
assert!(as_been_updated.swap(false, Relaxed));
|
||||||
assert!(status.result.is_ok());
|
assert!(status.result.is_ok());
|
||||||
|
assert_eq!(index.number_of_documents(), 1);
|
||||||
|
|
||||||
let docs = index.query_builder().query("hello", 0..10).unwrap();
|
let docs = index.query_builder().query("hello", 0..10).unwrap();
|
||||||
assert_eq!(docs.len(), 1);
|
assert_eq!(docs.len(), 1);
|
||||||
assert_eq!(index.document(None, docs[0].id).unwrap().as_ref(), Some(&doc1));
|
assert_eq!(index.document(None, docs[0].id).unwrap().as_ref(), Some(&doc1));
|
||||||
|
|
||||||
let mut deletion = index.documents_addition();
|
let mut addition = index.documents_addition();
|
||||||
deletion.update_document(&doc2);
|
addition.update_document(&doc2);
|
||||||
let update_id = deletion.finalize().unwrap();
|
let update_id = addition.finalize().unwrap();
|
||||||
let status = index.update_status_blocking(update_id).unwrap();
|
let status = index.update_status_blocking(update_id).unwrap();
|
||||||
assert!(as_been_updated.swap(false, Relaxed));
|
assert!(as_been_updated.swap(false, Relaxed));
|
||||||
assert!(status.result.is_ok());
|
assert!(status.result.is_ok());
|
||||||
|
assert_eq!(index.number_of_documents(), 1);
|
||||||
|
|
||||||
let docs = index.query_builder().query("hello", 0..10).unwrap();
|
let docs = index.query_builder().query("hello", 0..10).unwrap();
|
||||||
assert_eq!(docs.len(), 0);
|
assert_eq!(docs.len(), 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user