mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
update tests
This commit is contained in:
parent
10b8a0ab00
commit
037724576e
@ -3,9 +3,9 @@ use serde_json::Value;
|
||||
use std::error::Error;
|
||||
use std::time::Duration;
|
||||
|
||||
use async_std::task::{block_on, sleep};
|
||||
use async_std::io::prelude::*;
|
||||
use assert_json_diff::assert_json_eq;
|
||||
use async_std::io::prelude::*;
|
||||
use async_std::task::{block_on, sleep};
|
||||
use http_service::Body;
|
||||
use http_service_mock::{make_server, TestBackend};
|
||||
use meilisearch_http::data::Data;
|
||||
@ -89,7 +89,8 @@ pub fn enrich_server_with_movies_settings(
|
||||
"popularity",
|
||||
],
|
||||
"stopWords": null,
|
||||
"synonyms": null
|
||||
"synonyms": null,
|
||||
"indexNewFields": false,
|
||||
});
|
||||
|
||||
let body = json.to_string().into_bytes();
|
||||
|
@ -661,7 +661,8 @@ fn search_with_settings_basic() {
|
||||
"popularity"
|
||||
],
|
||||
"stopWords": null,
|
||||
"synonyms": null
|
||||
"synonyms": null,
|
||||
"indexNewFields": false,
|
||||
});
|
||||
|
||||
common::update_config(&mut server, config);
|
||||
@ -766,7 +767,8 @@ fn search_with_settings_stop_words() {
|
||||
"popularity"
|
||||
],
|
||||
"stopWords": ["the"],
|
||||
"synonyms": null
|
||||
"synonyms": null,
|
||||
"indexNewFields": false,
|
||||
});
|
||||
|
||||
common::update_config(&mut server, config);
|
||||
@ -877,7 +879,8 @@ fn search_with_settings_synonyms() {
|
||||
"Captain America",
|
||||
"Iron Man"
|
||||
]
|
||||
}
|
||||
},
|
||||
"indexNewFields": false,
|
||||
});
|
||||
|
||||
common::update_config(&mut server, config);
|
||||
@ -983,7 +986,8 @@ fn search_with_settings_ranking_rules() {
|
||||
"popularity"
|
||||
],
|
||||
"stopWords": null,
|
||||
"synonyms": null
|
||||
"synonyms": null,
|
||||
"indexNewFields": false,
|
||||
});
|
||||
|
||||
common::update_config(&mut server, config);
|
||||
@ -1088,7 +1092,8 @@ fn search_with_settings_attributes_searchable() {
|
||||
"popularity"
|
||||
],
|
||||
"stopWords": null,
|
||||
"synonyms": null
|
||||
"synonyms": null,
|
||||
"indexNewFields": false,
|
||||
});
|
||||
|
||||
common::update_config(&mut server, config);
|
||||
@ -1096,23 +1101,6 @@ fn search_with_settings_attributes_searchable() {
|
||||
|
||||
let query = "q=avangers&limit=3";
|
||||
let response = json!([
|
||||
{
|
||||
"id": 299534,
|
||||
"popularity": 38.659,
|
||||
"vote_average": 8.3,
|
||||
"title": "Avengers: Endgame",
|
||||
"tagline": "Part of the journey is the end.",
|
||||
"overview": "After the devastating events of Avengers: Infinity War, the universe is in ruins due to the efforts of the Mad Titan, Thanos. With the help of remaining allies, the Avengers must assemble once more in order to undo Thanos' actions and restore order to the universe once and for all, no matter what consequences may be in store.",
|
||||
"director": "Anthony Russo",
|
||||
"producer": "Kevin Feige",
|
||||
"genres": [
|
||||
"Adventure",
|
||||
"Science Fiction",
|
||||
"Action"
|
||||
],
|
||||
"poster_path": "https://image.tmdb.org/t/p/w500/or06FN3Dka5tukK1e9sl16pB3iy.jpg",
|
||||
"vote_count": 10497
|
||||
},
|
||||
{
|
||||
"id": 299536,
|
||||
"popularity": 65.013,
|
||||
@ -1130,6 +1118,23 @@ fn search_with_settings_attributes_searchable() {
|
||||
"poster_path": "https://image.tmdb.org/t/p/w500/7WsyChQLEftFiDOVTGkv3hFpyyt.jpg",
|
||||
"vote_count": 16056
|
||||
},
|
||||
{
|
||||
"id": 299534,
|
||||
"popularity": 38.659,
|
||||
"vote_average": 8.3,
|
||||
"title": "Avengers: Endgame",
|
||||
"tagline": "Part of the journey is the end.",
|
||||
"overview": "After the devastating events of Avengers: Infinity War, the universe is in ruins due to the efforts of the Mad Titan, Thanos. With the help of remaining allies, the Avengers must assemble once more in order to undo Thanos' actions and restore order to the universe once and for all, no matter what consequences may be in store.",
|
||||
"director": "Anthony Russo",
|
||||
"producer": "Kevin Feige",
|
||||
"genres": [
|
||||
"Adventure",
|
||||
"Science Fiction",
|
||||
"Action"
|
||||
],
|
||||
"poster_path": "https://image.tmdb.org/t/p/w500/or06FN3Dka5tukK1e9sl16pB3iy.jpg",
|
||||
"vote_count": 10497
|
||||
},
|
||||
{
|
||||
"id": 100402,
|
||||
"popularity": 16.418,
|
||||
@ -1188,7 +1193,8 @@ fn search_with_settings_attributes_displayed() {
|
||||
"poster_path"
|
||||
],
|
||||
"stopWords": null,
|
||||
"synonyms": null
|
||||
"synonyms": null,
|
||||
"indexNewFields": false,
|
||||
});
|
||||
|
||||
common::update_config(&mut server, config);
|
||||
@ -1197,11 +1203,11 @@ fn search_with_settings_attributes_displayed() {
|
||||
let query = "q=avangers&limit=3";
|
||||
let response = json!([
|
||||
{
|
||||
"id": 24428,
|
||||
"title": "The Avengers",
|
||||
"tagline": "Some assembly required.",
|
||||
"overview": "When an unexpected enemy emerges and threatens global safety and security, Nick Fury, director of the international peacekeeping agency known as S.H.I.E.L.D., finds himself in need of a team to pull the world back from the brink of disaster. Spanning the globe, a daring recruitment effort begins!",
|
||||
"poster_path": "https://image.tmdb.org/t/p/w500/cezWGskPY5x7GaglTTRN4Fugfb8.jpg"
|
||||
"id": 299536,
|
||||
"title": "Avengers: Infinity War",
|
||||
"tagline": "An entire universe. Once and for all.",
|
||||
"overview": "As the Avengers and their allies have continued to protect the world from threats too large for any one hero to handle, a new danger has emerged from the cosmic shadows: Thanos. A despot of intergalactic infamy, his goal is to collect all six Infinity Stones, artifacts of unimaginable power, and use them to inflict his twisted will on all of reality. Everything the Avengers have fought for has led up to this moment - the fate of Earth and existence itself has never been more uncertain.",
|
||||
"poster_path": "https://image.tmdb.org/t/p/w500/7WsyChQLEftFiDOVTGkv3hFpyyt.jpg"
|
||||
},
|
||||
{
|
||||
"id": 299534,
|
||||
@ -1211,11 +1217,11 @@ fn search_with_settings_attributes_displayed() {
|
||||
"poster_path": "https://image.tmdb.org/t/p/w500/or06FN3Dka5tukK1e9sl16pB3iy.jpg"
|
||||
},
|
||||
{
|
||||
"id": 299536,
|
||||
"title": "Avengers: Infinity War",
|
||||
"tagline": "An entire universe. Once and for all.",
|
||||
"overview": "As the Avengers and their allies have continued to protect the world from threats too large for any one hero to handle, a new danger has emerged from the cosmic shadows: Thanos. A despot of intergalactic infamy, his goal is to collect all six Infinity Stones, artifacts of unimaginable power, and use them to inflict his twisted will on all of reality. Everything the Avengers have fought for has led up to this moment - the fate of Earth and existence itself has never been more uncertain.",
|
||||
"poster_path": "https://image.tmdb.org/t/p/w500/7WsyChQLEftFiDOVTGkv3hFpyyt.jpg"
|
||||
"id": 99861,
|
||||
"title": "Avengers: Age of Ultron",
|
||||
"tagline": "A New Age Has Come.",
|
||||
"overview": "When Tony Stark tries to jumpstart a dormant peacekeeping program, things go awry and Earth’s Mightiest Heroes are put to the ultimate test as the fate of the planet hangs in the balance. As the villainous Ultron emerges, it is up to The Avengers to stop him from enacting his terrible plans, and soon uneasy alliances and unexpected action pave the way for an epic and unique global adventure.",
|
||||
"poster_path": "https://image.tmdb.org/t/p/w500/t90Y3G8UGQp0f0DrP60wRu9gfrH.jpg"
|
||||
}
|
||||
]);
|
||||
|
||||
@ -1258,7 +1264,8 @@ fn search_with_settings_attributes_searchable_2() {
|
||||
"poster_path"
|
||||
],
|
||||
"stopWords": null,
|
||||
"synonyms": null
|
||||
"synonyms": null,
|
||||
"indexNewFields": false,
|
||||
});
|
||||
|
||||
common::update_config(&mut server, config);
|
||||
@ -1266,13 +1273,6 @@ fn search_with_settings_attributes_searchable_2() {
|
||||
|
||||
let query = "q=avangers&limit=3";
|
||||
let response = json!([
|
||||
{
|
||||
"id": 299534,
|
||||
"title": "Avengers: Endgame",
|
||||
"tagline": "Part of the journey is the end.",
|
||||
"overview": "After the devastating events of Avengers: Infinity War, the universe is in ruins due to the efforts of the Mad Titan, Thanos. With the help of remaining allies, the Avengers must assemble once more in order to undo Thanos' actions and restore order to the universe once and for all, no matter what consequences may be in store.",
|
||||
"poster_path": "https://image.tmdb.org/t/p/w500/or06FN3Dka5tukK1e9sl16pB3iy.jpg"
|
||||
},
|
||||
{
|
||||
"id": 299536,
|
||||
"title": "Avengers: Infinity War",
|
||||
@ -1280,6 +1280,13 @@ fn search_with_settings_attributes_searchable_2() {
|
||||
"overview": "As the Avengers and their allies have continued to protect the world from threats too large for any one hero to handle, a new danger has emerged from the cosmic shadows: Thanos. A despot of intergalactic infamy, his goal is to collect all six Infinity Stones, artifacts of unimaginable power, and use them to inflict his twisted will on all of reality. Everything the Avengers have fought for has led up to this moment - the fate of Earth and existence itself has never been more uncertain.",
|
||||
"poster_path": "https://image.tmdb.org/t/p/w500/7WsyChQLEftFiDOVTGkv3hFpyyt.jpg"
|
||||
},
|
||||
{
|
||||
"id": 299534,
|
||||
"title": "Avengers: Endgame",
|
||||
"tagline": "Part of the journey is the end.",
|
||||
"overview": "After the devastating events of Avengers: Infinity War, the universe is in ruins due to the efforts of the Mad Titan, Thanos. With the help of remaining allies, the Avengers must assemble once more in order to undo Thanos' actions and restore order to the universe once and for all, no matter what consequences may be in store.",
|
||||
"poster_path": "https://image.tmdb.org/t/p/w500/or06FN3Dka5tukK1e9sl16pB3iy.jpg"
|
||||
},
|
||||
{
|
||||
"id": 100402,
|
||||
"title": "Captain America: The Winter Soldier",
|
||||
|
@ -75,7 +75,8 @@ fn write_all_and_delete() {
|
||||
"synonyms": {
|
||||
"wolverine": ["xmen", "logan"],
|
||||
"logan": ["wolverine"],
|
||||
}
|
||||
},
|
||||
"indexNewFields": false,
|
||||
});
|
||||
|
||||
let body = json.to_string().into_bytes();
|
||||
@ -132,7 +133,7 @@ fn write_all_and_delete() {
|
||||
"attributesDisplayed": null,
|
||||
"stopWords": null,
|
||||
"synonyms": null,
|
||||
"indexNewFields": true,
|
||||
"indexNewFields": null,
|
||||
});
|
||||
|
||||
assert_json_eq!(json, res_value, ordered: false);
|
||||
@ -203,7 +204,8 @@ fn write_all_and_update() {
|
||||
"synonyms": {
|
||||
"wolverine": ["xmen", "logan"],
|
||||
"logan": ["wolverine"],
|
||||
}
|
||||
},
|
||||
"indexNewFields": false,
|
||||
});
|
||||
|
||||
let body = json.to_string().into_bytes();
|
||||
@ -260,7 +262,8 @@ fn write_all_and_update() {
|
||||
"synonyms": {
|
||||
"wolverine": ["xmen", "logan"],
|
||||
"logan": ["wolverine", "xmen"],
|
||||
}
|
||||
},
|
||||
"indexNewFields": false,
|
||||
});
|
||||
|
||||
let body_update = json_update.to_string().into_bytes();
|
||||
@ -314,7 +317,7 @@ fn write_all_and_update() {
|
||||
"wolverine": ["xmen", "logan"],
|
||||
"logan": ["wolverine", "xmen"],
|
||||
},
|
||||
"indexNewFields": true
|
||||
"indexNewFields": false
|
||||
});
|
||||
|
||||
assert_json_eq!(res_expected, res_value, ordered: false);
|
||||
|
Loading…
Reference in New Issue
Block a user