Change the test for the new pagination.limited_to setting

This commit is contained in:
Kerollmops 2022-06-09 10:48:32 +02:00
parent 5cd13cc303
commit 6f0d3472b1
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -565,6 +565,36 @@ async fn placeholder_search_is_hard_limited() {
}, },
) )
.await; .await;
index
.update_settings(json!({ "pagination": { "limitedTo": 10_000 } }))
.await;
index.wait_task(1).await;
index
.search(
json!({
"limit": 1500,
}),
|response, code| {
assert_eq!(code, 200, "{}", response);
assert_eq!(response["hits"].as_array().unwrap().len(), 1200);
},
)
.await;
index
.search(
json!({
"offset": 1000,
"limit": 400,
}),
|response, code| {
assert_eq!(code, 200, "{}", response);
assert_eq!(response["hits"].as_array().unwrap().len(), 200);
},
)
.await;
} }
#[actix_rt::test] #[actix_rt::test]
@ -604,6 +634,38 @@ async fn search_is_hard_limited() {
}, },
) )
.await; .await;
index
.update_settings(json!({ "pagination": { "limitedTo": 10_000 } }))
.await;
index.wait_task(1).await;
index
.search(
json!({
"q": "unique",
"limit": 1500,
}),
|response, code| {
assert_eq!(code, 200, "{}", response);
assert_eq!(response["hits"].as_array().unwrap().len(), 1200);
},
)
.await;
index
.search(
json!({
"q": "unique",
"offset": 1000,
"limit": 400,
}),
|response, code| {
assert_eq!(code, 200, "{}", response);
assert_eq!(response["hits"].as_array().unwrap().len(), 200);
},
)
.await;
} }
#[actix_rt::test] #[actix_rt::test]