test list all indexes

This commit is contained in:
mpostma 2021-02-19 19:23:58 +01:00
parent 556ba956b8
commit 2bb695d60f
No known key found for this signature in database
GPG Key ID: CBC8A7C1D7A28C3A

View File

@ -41,3 +41,19 @@ async fn no_index_return_empty_list() {
assert!(response.is_array()); assert!(response.is_array());
assert!(response.as_array().unwrap().is_empty()); assert!(response.as_array().unwrap().is_empty());
} }
#[actix_rt::test]
async fn list_multiple_indexes() {
let server = Server::new().await;
server.index("test").create(None).await;
server.index("test1").create(Some("key")).await;
let (response, code) = server.list_indexes().await;
assert_eq!(code, 200);
assert!(response.is_array());
let arr = response.as_array().unwrap();
assert_eq!(arr.len(), 2);
assert!(arr.iter().find(|entry| entry["uid"] == "test" && entry["primaryKey"] == Value::Null).is_some());
assert!(arr.iter().find(|entry| entry["uid"] == "test1" && entry["primaryKey"] == "key").is_some());
}