Fix other unrelated tests

This commit is contained in:
ManyTheFish 2023-03-29 14:36:17 +02:00
parent efea1e5837
commit 6592746337
2 changed files with 28 additions and 28 deletions

View File

@ -14,7 +14,7 @@ async fn formatted_contain_wildcard() {
index.add_documents(documents, None).await;
index.wait_task(1).await;
index.search(json!({ "q": "pesti", "attributesToRetrieve": ["father", "mother"], "attributesToHighlight": ["father", "mother", "*"], "attributesToCrop": ["doggos"], "showMatchesPosition": true }),
index.search(json!({ "q": "pésti", "attributesToRetrieve": ["father", "mother"], "attributesToHighlight": ["father", "mother", "*"], "attributesToCrop": ["doggos"], "showMatchesPosition": true }),
|response, code|
{
assert_eq!(code, 200, "{}", response);
@ -23,7 +23,7 @@ async fn formatted_contain_wildcard() {
json!({
"_formatted": {
"id": "852",
"cattos": "<em>pesti</em>",
"cattos": "<em>pésti</em>",
},
"_matchesPosition": {"cattos": [{"start": 0, "length": 5}]},
})
@ -33,13 +33,13 @@ async fn formatted_contain_wildcard() {
.await;
index
.search(json!({ "q": "pesti", "attributesToRetrieve": ["*"] }), |response, code| {
.search(json!({ "q": "pésti", "attributesToRetrieve": ["*"] }), |response, code| {
assert_eq!(code, 200, "{}", response);
assert_eq!(
response["hits"][0],
json!({
"id": 852,
"cattos": "pesti",
"cattos": "pésti",
})
);
})
@ -47,17 +47,17 @@ async fn formatted_contain_wildcard() {
index
.search(
json!({ "q": "pesti", "attributesToRetrieve": ["*"], "attributesToHighlight": ["id"], "showMatchesPosition": true }),
json!({ "q": "pésti", "attributesToRetrieve": ["*"], "attributesToHighlight": ["id"], "showMatchesPosition": true }),
|response, code| {
assert_eq!(code, 200, "{}", response);
assert_eq!(
response["hits"][0],
json!({
"id": 852,
"cattos": "pesti",
"cattos": "pésti",
"_formatted": {
"id": "852",
"cattos": "pesti",
"cattos": "pésti",
},
"_matchesPosition": {"cattos": [{"start": 0, "length": 5}]},
})
@ -68,17 +68,17 @@ async fn formatted_contain_wildcard() {
index
.search(
json!({ "q": "pesti", "attributesToRetrieve": ["*"], "attributesToCrop": ["*"] }),
json!({ "q": "pésti", "attributesToRetrieve": ["*"], "attributesToCrop": ["*"] }),
|response, code| {
assert_eq!(code, 200, "{}", response);
assert_eq!(
response["hits"][0],
json!({
"id": 852,
"cattos": "pesti",
"cattos": "pésti",
"_formatted": {
"id": "852",
"cattos": "pesti",
"cattos": "pésti",
}
})
);
@ -87,16 +87,16 @@ async fn formatted_contain_wildcard() {
.await;
index
.search(json!({ "q": "pesti", "attributesToCrop": ["*"] }), |response, code| {
.search(json!({ "q": "pésti", "attributesToCrop": ["*"] }), |response, code| {
assert_eq!(code, 200, "{}", response);
assert_eq!(
response["hits"][0],
json!({
"id": 852,
"cattos": "pesti",
"cattos": "pésti",
"_formatted": {
"id": "852",
"cattos": "pesti",
"cattos": "pésti",
}
})
);
@ -114,7 +114,7 @@ async fn format_nested() {
index.wait_task(0).await;
index
.search(json!({ "q": "pesti", "attributesToRetrieve": ["doggos"] }), |response, code| {
.search(json!({ "q": "pésti", "attributesToRetrieve": ["doggos"] }), |response, code| {
assert_eq!(code, 200, "{}", response);
assert_eq!(
response["hits"][0],
@ -136,7 +136,7 @@ async fn format_nested() {
index
.search(
json!({ "q": "pesti", "attributesToRetrieve": ["doggos.name"] }),
json!({ "q": "pésti", "attributesToRetrieve": ["doggos.name"] }),
|response, code| {
assert_eq!(code, 200, "{}", response);
assert_eq!(
@ -180,7 +180,7 @@ async fn format_nested() {
.await;
index
.search(json!({ "q": "pesti", "attributesToRetrieve": [], "attributesToHighlight": ["doggos.name"] }),
.search(json!({ "q": "pésti", "attributesToRetrieve": [], "attributesToHighlight": ["doggos.name"] }),
|response, code| {
assert_eq!(code, 200, "{}", response);
assert_eq!(
@ -202,7 +202,7 @@ async fn format_nested() {
.await;
index
.search(json!({ "q": "pesti", "attributesToRetrieve": [], "attributesToCrop": ["doggos.name"] }),
.search(json!({ "q": "pésti", "attributesToRetrieve": [], "attributesToCrop": ["doggos.name"] }),
|response, code| {
assert_eq!(code, 200, "{}", response);
assert_eq!(
@ -224,7 +224,7 @@ async fn format_nested() {
.await;
index
.search(json!({ "q": "pesti", "attributesToRetrieve": ["doggos.name"], "attributesToHighlight": ["doggos.age"] }),
.search(json!({ "q": "pésti", "attributesToRetrieve": ["doggos.name"], "attributesToHighlight": ["doggos.age"] }),
|response, code| {
assert_eq!(code, 200, "{}", response);
assert_eq!(
@ -256,7 +256,7 @@ async fn format_nested() {
.await;
index
.search(json!({ "q": "pesti", "attributesToRetrieve": [], "attributesToHighlight": ["doggos.age"], "attributesToCrop": ["doggos.name"] }),
.search(json!({ "q": "pésti", "attributesToRetrieve": [], "attributesToHighlight": ["doggos.age"], "attributesToCrop": ["doggos.name"] }),
|response, code| {
assert_eq!(code, 200, "{}", response);
assert_eq!(

View File

@ -71,7 +71,7 @@ async fn simple_search_single_index() {
"indexUid": "test",
"hits": [
{
"title": "Glass",
"title": "Gläss",
"id": "450465"
}
],
@ -166,7 +166,7 @@ async fn simple_search_two_indexes() {
let (response, code) = server
.multi_search(json!({"queries": [
{"indexUid" : "test", "q": "glass"},
{"indexUid": "nested", "q": "pesti"},
{"indexUid": "nested", "q": "pésti"},
]}))
.await;
snapshot!(code, @"200 OK");
@ -176,7 +176,7 @@ async fn simple_search_two_indexes() {
"indexUid": "test",
"hits": [
{
"title": "Glass",
"title": "Gläss",
"id": "450465"
}
],
@ -203,7 +203,7 @@ async fn simple_search_two_indexes() {
"age": 4
}
],
"cattos": "pesti"
"cattos": "pésti"
},
{
"id": 654,
@ -221,7 +221,7 @@ async fn simple_search_two_indexes() {
]
}
],
"query": "pesti",
"query": "pésti",
"processingTimeMs": "[time]",
"limit": 20,
"offset": 0,
@ -243,7 +243,7 @@ async fn search_one_index_doesnt_exist() {
let (response, code) = server
.multi_search(json!({"queries": [
{"indexUid" : "test", "q": "glass"},
{"indexUid": "nested", "q": "pesti"},
{"indexUid": "nested", "q": "pésti"},
]}))
.await;
snapshot!(code, @"400 Bad Request");
@ -264,7 +264,7 @@ async fn search_multiple_indexes_dont_exist() {
let (response, code) = server
.multi_search(json!({"queries": [
{"indexUid" : "test", "q": "glass"},
{"indexUid": "nested", "q": "pesti"},
{"indexUid": "nested", "q": "pésti"},
]}))
.await;
snapshot!(code, @"400 Bad Request");
@ -296,7 +296,7 @@ async fn search_one_query_error() {
let (response, code) = server
.multi_search(json!({"queries": [
{"indexUid" : "test", "q": "glass", "facets": ["title"]},
{"indexUid": "nested", "q": "pesti"},
{"indexUid": "nested", "q": "pésti"},
]}))
.await;
snapshot!(code, @"400 Bad Request");
@ -328,7 +328,7 @@ async fn search_multiple_query_errors() {
let (response, code) = server
.multi_search(json!({"queries": [
{"indexUid" : "test", "q": "glass", "facets": ["title"]},
{"indexUid": "nested", "q": "pesti", "facets": ["doggos"]},
{"indexUid": "nested", "q": "pésti", "facets": ["doggos"]},
]}))
.await;
snapshot!(code, @"400 Bad Request");