mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-25 07:41:00 +00:00
add tests
This commit is contained in:
28
meilisearch-http/tests/search/errors.rs
Normal file
28
meilisearch-http/tests/search/errors.rs
Normal file
@ -0,0 +1,28 @@
|
||||
use crate::common::Server;
|
||||
use serde_json::json;
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn search_unexisting_index() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
|
||||
index
|
||||
.search(json!({"q": "hello"}), |response, code| {
|
||||
assert_eq!(code, 404, "{}", response);
|
||||
assert_eq!(response["errorCode"], "index_not_found");
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn search_unexisting_parameter() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
|
||||
index
|
||||
.search(json!({"marin": "hello"}), |response, code| {
|
||||
assert_eq!(code, 400, "{}", response);
|
||||
assert_eq!(response["errorCode"], "bad_request");
|
||||
})
|
||||
.await;
|
||||
}
|
Reference in New Issue
Block a user