From af26c3948219c1a8284f481f03791a2c4d44c8ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Sat, 14 Sep 2019 15:28:32 +0200 Subject: [PATCH] test: Improve the tests of the number of documents counting --- meilidb-data/tests/updates.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/meilidb-data/tests/updates.rs b/meilidb-data/tests/updates.rs index ecdd07003..576e11583 100644 --- a/meilidb-data/tests/updates.rs +++ b/meilidb-data/tests/updates.rs @@ -33,6 +33,7 @@ fn insert_delete_document() { let status = index.update_status_blocking(update_id).unwrap(); assert!(as_been_updated.swap(false, Relaxed)); assert!(status.result.is_ok()); + assert_eq!(index.number_of_documents(), 1); let docs = index.query_builder().query("hello", 0..10).unwrap(); assert_eq!(docs.len(), 1); @@ -44,6 +45,7 @@ fn insert_delete_document() { let status = index.update_status_blocking(update_id).unwrap(); assert!(as_been_updated.swap(false, Relaxed)); assert!(status.result.is_ok()); + assert_eq!(index.number_of_documents(), 0); let docs = index.query_builder().query("hello", 0..10).unwrap(); assert_eq!(docs.len(), 0); @@ -71,17 +73,19 @@ fn replace_document() { let status = index.update_status_blocking(update_id).unwrap(); assert!(as_been_updated.swap(false, Relaxed)); assert!(status.result.is_ok()); + assert_eq!(index.number_of_documents(), 1); let docs = index.query_builder().query("hello", 0..10).unwrap(); assert_eq!(docs.len(), 1); assert_eq!(index.document(None, docs[0].id).unwrap().as_ref(), Some(&doc1)); - let mut deletion = index.documents_addition(); - deletion.update_document(&doc2); - let update_id = deletion.finalize().unwrap(); + let mut addition = index.documents_addition(); + addition.update_document(&doc2); + let update_id = addition.finalize().unwrap(); let status = index.update_status_blocking(update_id).unwrap(); assert!(as_been_updated.swap(false, Relaxed)); assert!(status.result.is_ok()); + assert_eq!(index.number_of_documents(), 1); let docs = index.query_builder().query("hello", 0..10).unwrap(); assert_eq!(docs.len(), 0);