mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-02-11 21:13:32 +01:00
Convert dump test into snapshots
This commit is contained in:
parent
4e51750442
commit
c8724b1e97
@ -27,9 +27,25 @@ async fn import_dump_v1_movie_raw() {
|
||||
|
||||
let (stats, code) = index.stats().await;
|
||||
snapshot!(code, @"200 OK");
|
||||
assert_eq!(
|
||||
stats,
|
||||
json!({ "numberOfDocuments": 53, "isIndexing": false, "fieldDistribution": {"genres": 53, "id": 53, "overview": 53, "poster": 53, "release_date": 53, "title": 53 }})
|
||||
snapshot!(
|
||||
json_string!(stats),
|
||||
@r###"
|
||||
{
|
||||
"numberOfDocuments": 53,
|
||||
"rawDocumentDbSize": 21965,
|
||||
"maxDocumentSize": 743,
|
||||
"avgDocumentSize": 414,
|
||||
"isIndexing": false,
|
||||
"fieldDistribution": {
|
||||
"genres": 53,
|
||||
"id": 53,
|
||||
"overview": 53,
|
||||
"poster": 53,
|
||||
"release_date": 53,
|
||||
"title": 53
|
||||
}
|
||||
}
|
||||
"###
|
||||
);
|
||||
|
||||
let (settings, code) = index.settings().await;
|
||||
@ -336,9 +352,25 @@ async fn import_dump_v1_rubygems_with_settings() {
|
||||
|
||||
let (stats, code) = index.stats().await;
|
||||
snapshot!(code, @"200 OK");
|
||||
assert_eq!(
|
||||
stats,
|
||||
json!({ "numberOfDocuments": 53, "isIndexing": false, "fieldDistribution": {"description": 53, "id": 53, "name": 53, "summary": 53, "total_downloads": 53, "version": 53 }})
|
||||
snapshot!(
|
||||
json_string!(stats),
|
||||
@r###"
|
||||
{
|
||||
"numberOfDocuments": 53,
|
||||
"rawDocumentDbSize": 8606,
|
||||
"maxDocumentSize": 465,
|
||||
"avgDocumentSize": 162,
|
||||
"isIndexing": false,
|
||||
"fieldDistribution": {
|
||||
"description": 53,
|
||||
"id": 53,
|
||||
"name": 53,
|
||||
"summary": 53,
|
||||
"total_downloads": 53,
|
||||
"version": 53
|
||||
}
|
||||
}
|
||||
"###
|
||||
);
|
||||
|
||||
let (settings, code) = index.settings().await;
|
||||
@ -486,9 +518,25 @@ async fn import_dump_v2_movie_raw() {
|
||||
|
||||
let (stats, code) = index.stats().await;
|
||||
snapshot!(code, @"200 OK");
|
||||
assert_eq!(
|
||||
stats,
|
||||
json!({ "numberOfDocuments": 53, "isIndexing": false, "fieldDistribution": {"genres": 53, "id": 53, "overview": 53, "poster": 53, "release_date": 53, "title": 53 }})
|
||||
snapshot!(
|
||||
json_string!(stats),
|
||||
@r###"
|
||||
{
|
||||
"numberOfDocuments": 53,
|
||||
"rawDocumentDbSize": 21965,
|
||||
"maxDocumentSize": 743,
|
||||
"avgDocumentSize": 414,
|
||||
"isIndexing": false,
|
||||
"fieldDistribution": {
|
||||
"genres": 53,
|
||||
"id": 53,
|
||||
"overview": 53,
|
||||
"poster": 53,
|
||||
"release_date": 53,
|
||||
"title": 53
|
||||
}
|
||||
}
|
||||
"###
|
||||
);
|
||||
|
||||
let (settings, code) = index.settings().await;
|
||||
@ -626,9 +674,25 @@ async fn import_dump_v2_movie_with_settings() {
|
||||
|
||||
let (stats, code) = index.stats().await;
|
||||
snapshot!(code, @"200 OK");
|
||||
assert_eq!(
|
||||
stats,
|
||||
json!({ "numberOfDocuments": 53, "isIndexing": false, "fieldDistribution": {"genres": 53, "id": 53, "overview": 53, "poster": 53, "release_date": 53, "title": 53 }})
|
||||
snapshot!(
|
||||
json_string!(stats),
|
||||
@r###"
|
||||
{
|
||||
"numberOfDocuments": 53,
|
||||
"rawDocumentDbSize": 21965,
|
||||
"maxDocumentSize": 743,
|
||||
"avgDocumentSize": 414,
|
||||
"isIndexing": false,
|
||||
"fieldDistribution": {
|
||||
"genres": 53,
|
||||
"id": 53,
|
||||
"overview": 53,
|
||||
"poster": 53,
|
||||
"release_date": 53,
|
||||
"title": 53
|
||||
}
|
||||
}
|
||||
"###
|
||||
);
|
||||
|
||||
let (settings, code) = index.settings().await;
|
||||
@ -776,9 +840,25 @@ async fn import_dump_v2_rubygems_with_settings() {
|
||||
|
||||
let (stats, code) = index.stats().await;
|
||||
snapshot!(code, @"200 OK");
|
||||
assert_eq!(
|
||||
stats,
|
||||
json!({ "numberOfDocuments": 53, "isIndexing": false, "fieldDistribution": {"description": 53, "id": 53, "name": 53, "summary": 53, "total_downloads": 53, "version": 53 }})
|
||||
snapshot!(
|
||||
json_string!(stats),
|
||||
@r###"
|
||||
{
|
||||
"numberOfDocuments": 53,
|
||||
"rawDocumentDbSize": 8606,
|
||||
"maxDocumentSize": 465,
|
||||
"avgDocumentSize": 162,
|
||||
"isIndexing": false,
|
||||
"fieldDistribution": {
|
||||
"description": 53,
|
||||
"id": 53,
|
||||
"name": 53,
|
||||
"summary": 53,
|
||||
"total_downloads": 53,
|
||||
"version": 53
|
||||
}
|
||||
}
|
||||
"###
|
||||
);
|
||||
|
||||
let (settings, code) = index.settings().await;
|
||||
@ -923,9 +1003,25 @@ async fn import_dump_v3_movie_raw() {
|
||||
|
||||
let (stats, code) = index.stats().await;
|
||||
snapshot!(code, @"200 OK");
|
||||
assert_eq!(
|
||||
stats,
|
||||
json!({ "numberOfDocuments": 53, "isIndexing": false, "fieldDistribution": {"genres": 53, "id": 53, "overview": 53, "poster": 53, "release_date": 53, "title": 53 }})
|
||||
snapshot!(
|
||||
json_string!(stats),
|
||||
@r###"
|
||||
{
|
||||
"numberOfDocuments": 53,
|
||||
"rawDocumentDbSize": 21965,
|
||||
"maxDocumentSize": 743,
|
||||
"avgDocumentSize": 414,
|
||||
"isIndexing": false,
|
||||
"fieldDistribution": {
|
||||
"genres": 53,
|
||||
"id": 53,
|
||||
"overview": 53,
|
||||
"poster": 53,
|
||||
"release_date": 53,
|
||||
"title": 53
|
||||
}
|
||||
}
|
||||
"###
|
||||
);
|
||||
|
||||
let (settings, code) = index.settings().await;
|
||||
@ -1063,9 +1159,25 @@ async fn import_dump_v3_movie_with_settings() {
|
||||
|
||||
let (stats, code) = index.stats().await;
|
||||
snapshot!(code, @"200 OK");
|
||||
assert_eq!(
|
||||
stats,
|
||||
json!({ "numberOfDocuments": 53, "isIndexing": false, "fieldDistribution": {"genres": 53, "id": 53, "overview": 53, "poster": 53, "release_date": 53, "title": 53 }})
|
||||
snapshot!(
|
||||
json_string!(stats),
|
||||
@r###"
|
||||
{
|
||||
"numberOfDocuments": 53,
|
||||
"rawDocumentDbSize": 21965,
|
||||
"maxDocumentSize": 743,
|
||||
"avgDocumentSize": 414,
|
||||
"isIndexing": false,
|
||||
"fieldDistribution": {
|
||||
"genres": 53,
|
||||
"id": 53,
|
||||
"overview": 53,
|
||||
"poster": 53,
|
||||
"release_date": 53,
|
||||
"title": 53
|
||||
}
|
||||
}
|
||||
"###
|
||||
);
|
||||
|
||||
let (settings, code) = index.settings().await;
|
||||
@ -1213,9 +1325,25 @@ async fn import_dump_v3_rubygems_with_settings() {
|
||||
|
||||
let (stats, code) = index.stats().await;
|
||||
snapshot!(code, @"200 OK");
|
||||
assert_eq!(
|
||||
stats,
|
||||
json!({ "numberOfDocuments": 53, "isIndexing": false, "fieldDistribution": {"description": 53, "id": 53, "name": 53, "summary": 53, "total_downloads": 53, "version": 53 }})
|
||||
snapshot!(
|
||||
json_string!(stats),
|
||||
@r###"
|
||||
{
|
||||
"numberOfDocuments": 53,
|
||||
"rawDocumentDbSize": 8606,
|
||||
"maxDocumentSize": 465,
|
||||
"avgDocumentSize": 162,
|
||||
"isIndexing": false,
|
||||
"fieldDistribution": {
|
||||
"description": 53,
|
||||
"id": 53,
|
||||
"name": 53,
|
||||
"summary": 53,
|
||||
"total_downloads": 53,
|
||||
"version": 53
|
||||
}
|
||||
}
|
||||
"###
|
||||
);
|
||||
|
||||
let (settings, code) = index.settings().await;
|
||||
@ -1360,9 +1488,25 @@ async fn import_dump_v4_movie_raw() {
|
||||
|
||||
let (stats, code) = index.stats().await;
|
||||
snapshot!(code, @"200 OK");
|
||||
assert_eq!(
|
||||
stats,
|
||||
json!({ "numberOfDocuments": 53, "isIndexing": false, "fieldDistribution": {"genres": 53, "id": 53, "overview": 53, "poster": 53, "release_date": 53, "title": 53 }})
|
||||
snapshot!(
|
||||
json_string!(stats),
|
||||
@r###"
|
||||
{
|
||||
"numberOfDocuments": 53,
|
||||
"rawDocumentDbSize": 21965,
|
||||
"maxDocumentSize": 743,
|
||||
"avgDocumentSize": 414,
|
||||
"isIndexing": false,
|
||||
"fieldDistribution": {
|
||||
"genres": 53,
|
||||
"id": 53,
|
||||
"overview": 53,
|
||||
"poster": 53,
|
||||
"release_date": 53,
|
||||
"title": 53
|
||||
}
|
||||
}
|
||||
"###
|
||||
);
|
||||
|
||||
let (settings, code) = index.settings().await;
|
||||
@ -1500,9 +1644,25 @@ async fn import_dump_v4_movie_with_settings() {
|
||||
|
||||
let (stats, code) = index.stats().await;
|
||||
snapshot!(code, @"200 OK");
|
||||
assert_eq!(
|
||||
stats,
|
||||
json!({ "numberOfDocuments": 53, "isIndexing": false, "fieldDistribution": {"genres": 53, "id": 53, "overview": 53, "poster": 53, "release_date": 53, "title": 53 }})
|
||||
snapshot!(
|
||||
json_string!(stats),
|
||||
@r###"
|
||||
{
|
||||
"numberOfDocuments": 53,
|
||||
"rawDocumentDbSize": 21965,
|
||||
"maxDocumentSize": 743,
|
||||
"avgDocumentSize": 414,
|
||||
"isIndexing": false,
|
||||
"fieldDistribution": {
|
||||
"genres": 53,
|
||||
"id": 53,
|
||||
"overview": 53,
|
||||
"poster": 53,
|
||||
"release_date": 53,
|
||||
"title": 53
|
||||
}
|
||||
}
|
||||
"###
|
||||
);
|
||||
|
||||
let (settings, code) = index.settings().await;
|
||||
@ -1650,9 +1810,25 @@ async fn import_dump_v4_rubygems_with_settings() {
|
||||
|
||||
let (stats, code) = index.stats().await;
|
||||
snapshot!(code, @"200 OK");
|
||||
assert_eq!(
|
||||
stats,
|
||||
json!({ "numberOfDocuments": 53, "isIndexing": false, "fieldDistribution": {"description": 53, "id": 53, "name": 53, "summary": 53, "total_downloads": 53, "version": 53 }})
|
||||
snapshot!(
|
||||
json_string!(stats),
|
||||
@r###"
|
||||
{
|
||||
"numberOfDocuments": 53,
|
||||
"rawDocumentDbSize": 8606,
|
||||
"maxDocumentSize": 465,
|
||||
"avgDocumentSize": 162,
|
||||
"isIndexing": false,
|
||||
"fieldDistribution": {
|
||||
"description": 53,
|
||||
"id": 53,
|
||||
"name": 53,
|
||||
"summary": 53,
|
||||
"total_downloads": 53,
|
||||
"version": 53
|
||||
}
|
||||
}
|
||||
"###
|
||||
);
|
||||
|
||||
let (settings, code) = index.settings().await;
|
||||
@ -1801,33 +1977,36 @@ async fn import_dump_v5() {
|
||||
server.wait_task(task["uid"].as_u64().unwrap()).await;
|
||||
}
|
||||
|
||||
let expected_stats = json!({
|
||||
"numberOfDocuments": 10,
|
||||
"isIndexing": false,
|
||||
"fieldDistribution": {
|
||||
"cast": 10,
|
||||
"director": 10,
|
||||
"genres": 10,
|
||||
"id": 10,
|
||||
"overview": 10,
|
||||
"popularity": 10,
|
||||
"poster_path": 10,
|
||||
"producer": 10,
|
||||
"production_companies": 10,
|
||||
"release_date": 10,
|
||||
"tagline": 10,
|
||||
"title": 10,
|
||||
"vote_average": 10,
|
||||
"vote_count": 10
|
||||
}
|
||||
});
|
||||
|
||||
let index1 = server.index("test");
|
||||
let index2 = server.index("test2");
|
||||
|
||||
let (stats, code) = index1.stats().await;
|
||||
snapshot!(code, @"200 OK");
|
||||
assert_eq!(stats, expected_stats);
|
||||
snapshot!(json_string!(stats), @r###"
|
||||
{
|
||||
"numberOfDocuments": 10,
|
||||
"rawDocumentDbSize": 6782,
|
||||
"maxDocumentSize": 1725,
|
||||
"avgDocumentSize": 678,
|
||||
"isIndexing": false,
|
||||
"fieldDistribution": {
|
||||
"cast": 10,
|
||||
"director": 10,
|
||||
"genres": 10,
|
||||
"id": 10,
|
||||
"overview": 10,
|
||||
"popularity": 10,
|
||||
"poster_path": 10,
|
||||
"producer": 10,
|
||||
"production_companies": 10,
|
||||
"release_date": 10,
|
||||
"tagline": 10,
|
||||
"title": 10,
|
||||
"vote_average": 10,
|
||||
"vote_count": 10
|
||||
}
|
||||
}
|
||||
"###);
|
||||
|
||||
let (docs, code) = index2.get_all_documents(GetAllDocumentsOptions::default()).await;
|
||||
snapshot!(code, @"200 OK");
|
||||
@ -1838,7 +2017,33 @@ async fn import_dump_v5() {
|
||||
|
||||
let (stats, code) = index2.stats().await;
|
||||
snapshot!(code, @"200 OK");
|
||||
assert_eq!(stats, expected_stats);
|
||||
snapshot!(
|
||||
json_string!(stats),
|
||||
@r###"
|
||||
{
|
||||
"numberOfDocuments": 10,
|
||||
"rawDocumentDbSize": 6782,
|
||||
"maxDocumentSize": 1725,
|
||||
"avgDocumentSize": 678,
|
||||
"isIndexing": false,
|
||||
"fieldDistribution": {
|
||||
"cast": 10,
|
||||
"director": 10,
|
||||
"genres": 10,
|
||||
"id": 10,
|
||||
"overview": 10,
|
||||
"popularity": 10,
|
||||
"poster_path": 10,
|
||||
"producer": 10,
|
||||
"production_companies": 10,
|
||||
"release_date": 10,
|
||||
"tagline": 10,
|
||||
"title": 10,
|
||||
"vote_average": 10,
|
||||
"vote_count": 10
|
||||
}
|
||||
}
|
||||
"###);
|
||||
|
||||
let (keys, code) = server.list_api_keys("").await;
|
||||
snapshot!(code, @"200 OK");
|
||||
|
Loading…
x
Reference in New Issue
Block a user