From 95eb6ad09a138fd75bec76f0c29c0bf97845d37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Wed, 6 Nov 2019 10:49:31 +0100 Subject: [PATCH] Add a test to check index soft deletion works correctly --- meilidb-core/src/database.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/meilidb-core/src/database.rs b/meilidb-core/src/database.rs index b65086ac2..0e40b695d 100644 --- a/meilidb-core/src/database.rs +++ b/meilidb-core/src/database.rs @@ -765,4 +765,18 @@ mod tests { }); assert_eq!(document, Some(new_doc2)); } + + #[test] + fn delete_index() { + let dir = tempfile::tempdir().unwrap(); + + let database = Database::open_or_create(dir.path()).unwrap(); + let _index = database.create_index("test").unwrap(); + + let deleted = database.delete_index("test").unwrap(); + assert!(deleted); + + let result = database.open_index("test"); + assert!(result.is_none()); + } }