2020-03-04 15:06:16 +01:00
|
|
|
mod common;
|
|
|
|
|
2020-04-16 11:09:47 +02:00
|
|
|
#[actix_rt::test]
|
|
|
|
async fn delete() {
|
2020-05-30 17:06:02 +05:30
|
|
|
let mut server = common::Server::test_server().await;
|
2020-03-04 15:06:16 +01:00
|
|
|
|
2020-05-30 17:06:02 +05:30
|
|
|
let (_response, status_code) = server.get_document(50).await;
|
2020-03-04 15:06:16 +01:00
|
|
|
assert_eq!(status_code, 200);
|
|
|
|
|
2020-05-30 17:06:02 +05:30
|
|
|
server.delete_document(50).await;
|
2020-03-04 15:06:16 +01:00
|
|
|
|
2020-05-30 17:06:02 +05:30
|
|
|
let (_response, status_code) = server.get_document(50).await;
|
2020-03-04 15:06:16 +01:00
|
|
|
assert_eq!(status_code, 404);
|
|
|
|
}
|
|
|
|
|
2020-05-22 18:04:23 +02:00
|
|
|
// Resolve the issue https://github.com/meilisearch/MeiliSearch/issues/493
|
2020-04-16 11:09:47 +02:00
|
|
|
#[actix_rt::test]
|
|
|
|
async fn delete_batch() {
|
2020-05-30 17:06:02 +05:30
|
|
|
let mut server = common::Server::test_server().await;
|
2020-03-04 15:06:16 +01:00
|
|
|
|
2020-05-30 17:06:02 +05:30
|
|
|
let doc_ids = vec!(50, 55, 60);
|
|
|
|
for doc_id in &doc_ids {
|
|
|
|
let (_response, status_code) = server.get_document(doc_id).await;
|
|
|
|
assert_eq!(status_code, 200);
|
|
|
|
}
|
2020-03-04 15:06:16 +01:00
|
|
|
|
2020-05-30 17:06:02 +05:30
|
|
|
let body = serde_json::json!(&doc_ids);
|
2020-04-16 11:09:47 +02:00
|
|
|
server.delete_multiple_documents(body).await;
|
2020-03-04 15:06:16 +01:00
|
|
|
|
2020-05-30 17:06:02 +05:30
|
|
|
for doc_id in &doc_ids {
|
|
|
|
let (_response, status_code) = server.get_document(doc_id).await;
|
|
|
|
assert_eq!(status_code, 404);
|
|
|
|
}
|
2020-03-04 15:06:16 +01:00
|
|
|
}
|