diff --git a/dump/src/lib.rs b/dump/src/lib.rs index 25e8d473b..0b34b16ba 100644 --- a/dump/src/lib.rs +++ b/dump/src/lib.rs @@ -417,7 +417,6 @@ pub(crate) mod test { } #[test] - #[ignore] fn test_creating_and_read_dump() { let mut file = create_test_dump(); let mut dump = DumpReader::open(&mut file).unwrap(); diff --git a/dump/src/reader/compat/snapshots/dump__reader__compat__v2_to_v3__test__compat_v2_v3-11.snap b/dump/src/reader/compat/snapshots/dump__reader__compat__v2_to_v3__test__compat_v2_v3-11.snap new file mode 100644 index 000000000..d722c1529 --- /dev/null +++ b/dump/src/reader/compat/snapshots/dump__reader__compat__v2_to_v3__test__compat_v2_v3-11.snap @@ -0,0 +1,23 @@ +--- +source: dump/src/reader/compat/v2_to_v3.rs +expression: movies2.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "exactness" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/compat/snapshots/dump__reader__compat__v2_to_v3__test__compat_v2_v3-14.snap b/dump/src/reader/compat/snapshots/dump__reader__compat__v2_to_v3__test__compat_v2_v3-14.snap new file mode 100644 index 000000000..3c5acae54 --- /dev/null +++ b/dump/src/reader/compat/snapshots/dump__reader__compat__v2_to_v3__test__compat_v2_v3-14.snap @@ -0,0 +1,23 @@ +--- +source: dump/src/reader/compat/v2_to_v3.rs +expression: spells.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "exactness" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/compat/snapshots/dump__reader__compat__v2_to_v3__test__compat_v2_v3-5.snap b/dump/src/reader/compat/snapshots/dump__reader__compat__v2_to_v3__test__compat_v2_v3-5.snap new file mode 100644 index 000000000..7668b91d3 --- /dev/null +++ b/dump/src/reader/compat/snapshots/dump__reader__compat__v2_to_v3__test__compat_v2_v3-5.snap @@ -0,0 +1,37 @@ +--- +source: dump/src/reader/compat/v2_to_v3.rs +expression: products.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "exactness" + ], + "stopWords": [], + "synonyms": { + "android": [ + "phone", + "smartphone" + ], + "iphone": [ + "phone", + "smartphone" + ], + "phone": [ + "android", + "iphone", + "smartphone" + ] + }, + "distinctAttribute": null +} diff --git a/dump/src/reader/compat/snapshots/dump__reader__compat__v2_to_v3__test__compat_v2_v3-8.snap b/dump/src/reader/compat/snapshots/dump__reader__compat__v2_to_v3__test__compat_v2_v3-8.snap new file mode 100644 index 000000000..fcae9d2d3 --- /dev/null +++ b/dump/src/reader/compat/snapshots/dump__reader__compat__v2_to_v3__test__compat_v2_v3-8.snap @@ -0,0 +1,24 @@ +--- +source: dump/src/reader/compat/v2_to_v3.rs +expression: movies.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "exactness", + "release_date:asc" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/compat/snapshots/dump__reader__compat__v3_to_v4__test__compat_v3_v4-12.snap b/dump/src/reader/compat/snapshots/dump__reader__compat__v3_to_v4__test__compat_v3_v4-12.snap new file mode 100644 index 000000000..10b7e3183 --- /dev/null +++ b/dump/src/reader/compat/snapshots/dump__reader__compat__v3_to_v4__test__compat_v3_v4-12.snap @@ -0,0 +1,25 @@ +--- +source: dump/src/reader/compat/v3_to_v4.rs +expression: movies2.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "sortableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/compat/snapshots/dump__reader__compat__v3_to_v4__test__compat_v3_v4-15.snap b/dump/src/reader/compat/snapshots/dump__reader__compat__v3_to_v4__test__compat_v3_v4-15.snap new file mode 100644 index 000000000..5b07a35d0 --- /dev/null +++ b/dump/src/reader/compat/snapshots/dump__reader__compat__v3_to_v4__test__compat_v3_v4-15.snap @@ -0,0 +1,25 @@ +--- +source: dump/src/reader/compat/v3_to_v4.rs +expression: spells.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "sortableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/compat/snapshots/dump__reader__compat__v3_to_v4__test__compat_v3_v4-6.snap b/dump/src/reader/compat/snapshots/dump__reader__compat__v3_to_v4__test__compat_v3_v4-6.snap new file mode 100644 index 000000000..969336b04 --- /dev/null +++ b/dump/src/reader/compat/snapshots/dump__reader__compat__v3_to_v4__test__compat_v3_v4-6.snap @@ -0,0 +1,39 @@ +--- +source: dump/src/reader/compat/v3_to_v4.rs +expression: products.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "sortableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ], + "stopWords": [], + "synonyms": { + "android": [ + "phone", + "smartphone" + ], + "iphone": [ + "phone", + "smartphone" + ], + "phone": [ + "android", + "iphone", + "smartphone" + ] + }, + "distinctAttribute": null +} diff --git a/dump/src/reader/compat/snapshots/dump__reader__compat__v3_to_v4__test__compat_v3_v4-9.snap b/dump/src/reader/compat/snapshots/dump__reader__compat__v3_to_v4__test__compat_v3_v4-9.snap new file mode 100644 index 000000000..15c395919 --- /dev/null +++ b/dump/src/reader/compat/snapshots/dump__reader__compat__v3_to_v4__test__compat_v3_v4-9.snap @@ -0,0 +1,31 @@ +--- +source: dump/src/reader/compat/v3_to_v4.rs +expression: movies.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [ + "genres", + "id" + ], + "sortableAttributes": [ + "release_date" + ], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness", + "release_date:asc" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/compat/snapshots/dump__reader__compat__v4_to_v5__test__compat_v4_v5-12.snap b/dump/src/reader/compat/snapshots/dump__reader__compat__v4_to_v5__test__compat_v4_v5-12.snap new file mode 100644 index 000000000..415e0c597 --- /dev/null +++ b/dump/src/reader/compat/snapshots/dump__reader__compat__v4_to_v5__test__compat_v4_v5-12.snap @@ -0,0 +1,56 @@ +--- +source: dump/src/reader/compat/v4_to_v5.rs +expression: spells.settings().unwrap() +--- +{ + "displayedAttributes": "Reset", + "searchableAttributes": "Reset", + "filterableAttributes": { + "Set": [] + }, + "sortableAttributes": { + "Set": [] + }, + "rankingRules": { + "Set": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ] + }, + "stopWords": { + "Set": [] + }, + "synonyms": { + "Set": {} + }, + "distinctAttribute": "Reset", + "typoTolerance": { + "Set": { + "enabled": { + "Set": true + }, + "minWordSizeForTypos": { + "Set": { + "oneTypo": { + "Set": 5 + }, + "twoTypos": { + "Set": 9 + } + } + }, + "disableOnWords": { + "Set": [] + }, + "disableOnAttributes": { + "Set": [] + } + } + }, + "faceting": "NotSet", + "pagination": "NotSet" +} diff --git a/dump/src/reader/compat/snapshots/dump__reader__compat__v4_to_v5__test__compat_v4_v5-6.snap b/dump/src/reader/compat/snapshots/dump__reader__compat__v4_to_v5__test__compat_v4_v5-6.snap new file mode 100644 index 000000000..0373106e5 --- /dev/null +++ b/dump/src/reader/compat/snapshots/dump__reader__compat__v4_to_v5__test__compat_v4_v5-6.snap @@ -0,0 +1,70 @@ +--- +source: dump/src/reader/compat/v4_to_v5.rs +expression: products.settings().unwrap() +--- +{ + "displayedAttributes": "Reset", + "searchableAttributes": "Reset", + "filterableAttributes": { + "Set": [] + }, + "sortableAttributes": { + "Set": [] + }, + "rankingRules": { + "Set": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ] + }, + "stopWords": { + "Set": [] + }, + "synonyms": { + "Set": { + "android": [ + "phone", + "smartphone" + ], + "iphone": [ + "phone", + "smartphone" + ], + "phone": [ + "android", + "iphone", + "smartphone" + ] + } + }, + "distinctAttribute": "Reset", + "typoTolerance": { + "Set": { + "enabled": { + "Set": true + }, + "minWordSizeForTypos": { + "Set": { + "oneTypo": { + "Set": 5 + }, + "twoTypos": { + "Set": 9 + } + } + }, + "disableOnWords": { + "Set": [] + }, + "disableOnAttributes": { + "Set": [] + } + } + }, + "faceting": "NotSet", + "pagination": "NotSet" +} diff --git a/dump/src/reader/compat/snapshots/dump__reader__compat__v4_to_v5__test__compat_v4_v5-9.snap b/dump/src/reader/compat/snapshots/dump__reader__compat__v4_to_v5__test__compat_v4_v5-9.snap new file mode 100644 index 000000000..ab4cf5a90 --- /dev/null +++ b/dump/src/reader/compat/snapshots/dump__reader__compat__v4_to_v5__test__compat_v4_v5-9.snap @@ -0,0 +1,62 @@ +--- +source: dump/src/reader/compat/v4_to_v5.rs +expression: movies.settings().unwrap() +--- +{ + "displayedAttributes": "Reset", + "searchableAttributes": "Reset", + "filterableAttributes": { + "Set": [ + "genres", + "id" + ] + }, + "sortableAttributes": { + "Set": [ + "release_date" + ] + }, + "rankingRules": { + "Set": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness", + "release_date:asc" + ] + }, + "stopWords": { + "Set": [] + }, + "synonyms": { + "Set": {} + }, + "distinctAttribute": "Reset", + "typoTolerance": { + "Set": { + "enabled": { + "Set": true + }, + "minWordSizeForTypos": { + "Set": { + "oneTypo": { + "Set": 5 + }, + "twoTypos": { + "Set": 9 + } + } + }, + "disableOnWords": { + "Set": [] + }, + "disableOnAttributes": { + "Set": [] + } + } + }, + "faceting": "NotSet", + "pagination": "NotSet" +} diff --git a/dump/src/reader/compat/snapshots/dump__reader__compat__v5_to_v6__test__compat_v5_v6-12.snap b/dump/src/reader/compat/snapshots/dump__reader__compat__v5_to_v6__test__compat_v5_v6-12.snap new file mode 100644 index 000000000..e85eecfd6 --- /dev/null +++ b/dump/src/reader/compat/snapshots/dump__reader__compat__v5_to_v6__test__compat_v5_v6-12.snap @@ -0,0 +1,40 @@ +--- +source: dump/src/reader/compat/v5_to_v6.rs +expression: spells.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "sortableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null, + "typoTolerance": { + "enabled": true, + "minWordSizeForTypos": { + "oneTypo": 5, + "twoTypos": 9 + }, + "disableOnWords": [], + "disableOnAttributes": [] + }, + "faceting": { + "maxValuesPerFacet": 100 + }, + "pagination": { + "maxTotalHits": 1000 + } +} diff --git a/dump/src/reader/compat/snapshots/dump__reader__compat__v5_to_v6__test__compat_v5_v6-6.snap b/dump/src/reader/compat/snapshots/dump__reader__compat__v5_to_v6__test__compat_v5_v6-6.snap new file mode 100644 index 000000000..6cb9450e7 --- /dev/null +++ b/dump/src/reader/compat/snapshots/dump__reader__compat__v5_to_v6__test__compat_v5_v6-6.snap @@ -0,0 +1,54 @@ +--- +source: dump/src/reader/compat/v5_to_v6.rs +expression: products.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "sortableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ], + "stopWords": [], + "synonyms": { + "android": [ + "phone", + "smartphone" + ], + "iphone": [ + "phone", + "smartphone" + ], + "phone": [ + "android", + "iphone", + "smartphone" + ] + }, + "distinctAttribute": null, + "typoTolerance": { + "enabled": true, + "minWordSizeForTypos": { + "oneTypo": 5, + "twoTypos": 9 + }, + "disableOnWords": [], + "disableOnAttributes": [] + }, + "faceting": { + "maxValuesPerFacet": 100 + }, + "pagination": { + "maxTotalHits": 1000 + } +} diff --git a/dump/src/reader/compat/snapshots/dump__reader__compat__v5_to_v6__test__compat_v5_v6-9.snap b/dump/src/reader/compat/snapshots/dump__reader__compat__v5_to_v6__test__compat_v5_v6-9.snap new file mode 100644 index 000000000..949e82663 --- /dev/null +++ b/dump/src/reader/compat/snapshots/dump__reader__compat__v5_to_v6__test__compat_v5_v6-9.snap @@ -0,0 +1,46 @@ +--- +source: dump/src/reader/compat/v5_to_v6.rs +expression: movies.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [ + "genres", + "id" + ], + "sortableAttributes": [ + "release_date" + ], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness", + "release_date:asc" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null, + "typoTolerance": { + "enabled": true, + "minWordSizeForTypos": { + "oneTypo": 5, + "twoTypos": 9 + }, + "disableOnWords": [], + "disableOnAttributes": [] + }, + "faceting": { + "maxValuesPerFacet": 100 + }, + "pagination": { + "maxTotalHits": 1000 + } +} diff --git a/dump/src/reader/compat/v2_to_v3.rs b/dump/src/reader/compat/v2_to_v3.rs index 709670265..70bc5b867 100644 --- a/dump/src/reader/compat/v2_to_v3.rs +++ b/dump/src/reader/compat/v2_to_v3.rs @@ -381,7 +381,6 @@ pub(crate) mod test { use super::*; #[test] - #[ignore] fn compat_v2_v3() { let dump = File::open("tests/assets/v2.dump").unwrap(); let dir = TempDir::new().unwrap(); @@ -427,7 +426,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", products.settings()), @"54b3d7a0d96de35427d867fa17164a99"); + insta::assert_json_snapshot!(products.settings().unwrap()); let documents = products.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"548284a84de510f71e88e6cdea495cf5"); @@ -442,7 +441,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies.settings()), @"ae7c5ade2243a553152dab2f354e9095"); + insta::assert_json_snapshot!(movies.settings().unwrap()); let documents = movies.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 110); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"d153b5a81d8b3cdcbe1dec270b574022"); @@ -457,7 +456,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies2.settings()), @"1be82b894556d23953af557b6a328a58"); + insta::assert_json_snapshot!(movies2.settings().unwrap()); let documents = movies2.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 0); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"d751713988987e9331980363e24189ce"); @@ -472,7 +471,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", spells.settings()), @"1be82b894556d23953af557b6a328a58"); + insta::assert_json_snapshot!(spells.settings().unwrap()); let documents = spells.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"235016433dd04262c7f2da01d1e808ce"); diff --git a/dump/src/reader/compat/v3_to_v4.rs b/dump/src/reader/compat/v3_to_v4.rs index 46fe0c9b2..b4153eb31 100644 --- a/dump/src/reader/compat/v3_to_v4.rs +++ b/dump/src/reader/compat/v3_to_v4.rs @@ -347,7 +347,6 @@ pub(crate) mod test { use super::*; #[test] - #[ignore] fn compat_v3_v4() { let dump = File::open("tests/assets/v3.dump").unwrap(); let dir = TempDir::new().unwrap(); @@ -397,7 +396,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", products.settings()), @"d3402aff19b90acea9e9a07c466690aa"); + insta::assert_json_snapshot!(products.settings().unwrap()); let documents = products.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"548284a84de510f71e88e6cdea495cf5"); @@ -412,7 +411,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies.settings()), @"687aaab250f01b55d57bc69aa313b581"); + insta::assert_json_snapshot!(movies.settings().unwrap()); let documents = movies.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 110); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"d153b5a81d8b3cdcbe1dec270b574022"); @@ -427,7 +426,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies2.settings()), @"cd9fedbd7e3492831a94da62c90013ea"); + insta::assert_json_snapshot!(movies2.settings().unwrap()); let documents = movies2.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 0); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"d751713988987e9331980363e24189ce"); @@ -442,7 +441,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", spells.settings()), @"cd9fedbd7e3492831a94da62c90013ea"); + insta::assert_json_snapshot!(spells.settings().unwrap()); let documents = spells.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"235016433dd04262c7f2da01d1e808ce"); diff --git a/dump/src/reader/compat/v4_to_v5.rs b/dump/src/reader/compat/v4_to_v5.rs index 7f985186f..850e2cccd 100644 --- a/dump/src/reader/compat/v4_to_v5.rs +++ b/dump/src/reader/compat/v4_to_v5.rs @@ -383,7 +383,6 @@ pub(crate) mod test { use super::*; #[test] - #[ignore] fn compat_v4_v5() { let dump = File::open("tests/assets/v4.dump").unwrap(); let dir = TempDir::new().unwrap(); @@ -430,7 +429,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", products.settings()), @"26947283836ee4cdf0974f82efcc5332"); + insta::assert_json_snapshot!(products.settings().unwrap()); let documents = products.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"b01c8371aea4c7171af0d4d846a2bdca"); @@ -445,7 +444,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies.settings()), @"156871410d17e23803d0c90ddc6a66cb"); + insta::assert_json_snapshot!(movies.settings().unwrap()); let documents = movies.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 110); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"786022a66ecb992c8a2a60fee070a5ab"); @@ -460,7 +459,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", spells.settings()), @"69c9916142612cf4a2da9b9ed9455e9e"); + insta::assert_json_snapshot!(spells.settings().unwrap()); let documents = spells.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"235016433dd04262c7f2da01d1e808ce"); diff --git a/dump/src/reader/compat/v5_to_v6.rs b/dump/src/reader/compat/v5_to_v6.rs index c73fe23d0..0030ad0d2 100644 --- a/dump/src/reader/compat/v5_to_v6.rs +++ b/dump/src/reader/compat/v5_to_v6.rs @@ -401,7 +401,6 @@ pub(crate) mod test { use super::*; #[test] - #[ignore] fn compat_v5_v6() { let dump = File::open("tests/assets/v5.dump").unwrap(); let dir = TempDir::new().unwrap(); @@ -449,7 +448,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", products.settings()), @"8e5cadabf74aebe1160bf51c3d489efe"); + insta::assert_json_snapshot!(products.settings().unwrap()); let documents = products.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"b01c8371aea4c7171af0d4d846a2bdca"); @@ -464,7 +463,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies.settings()), @"4894ac1e74b9e1069ed5ee262b7a1aca"); + insta::assert_json_snapshot!(movies.settings().unwrap()); let documents = movies.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 200); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"e962baafd2fbae4cdd14e876053b0c5a"); @@ -479,7 +478,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", spells.settings()), @"054dbf08a79e08bb9becba6f5d090f13"); + insta::assert_json_snapshot!(spells.settings().unwrap()); let documents = spells.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"235016433dd04262c7f2da01d1e808ce"); diff --git a/dump/src/reader/mod.rs b/dump/src/reader/mod.rs index 9d0f6ae88..54481ab9e 100644 --- a/dump/src/reader/mod.rs +++ b/dump/src/reader/mod.rs @@ -189,7 +189,6 @@ pub(crate) mod test { use super::*; #[test] - #[ignore] fn import_dump_v5() { let dump = File::open("tests/assets/v5.dump").unwrap(); let mut dump = DumpReader::open(dump).unwrap(); @@ -231,7 +230,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", products.settings()), @"8e5cadabf74aebe1160bf51c3d489efe"); + insta::assert_json_snapshot!(products.settings().unwrap()); let documents = products.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"b01c8371aea4c7171af0d4d846a2bdca"); @@ -246,7 +245,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies.settings()), @"4894ac1e74b9e1069ed5ee262b7a1aca"); + insta::assert_json_snapshot!(movies.settings().unwrap()); let documents = movies.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 200); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"e962baafd2fbae4cdd14e876053b0c5a"); @@ -261,14 +260,13 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", spells.settings()), @"054dbf08a79e08bb9becba6f5d090f13"); + insta::assert_json_snapshot!(spells.settings().unwrap()); let documents = spells.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"235016433dd04262c7f2da01d1e808ce"); } #[test] - #[ignore] fn import_dump_v4() { let dump = File::open("tests/assets/v4.dump").unwrap(); let mut dump = DumpReader::open(dump).unwrap(); @@ -309,7 +307,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", products.settings()), @"1f9da51a4518166fb440def5437eafdb"); + insta::assert_json_snapshot!(products.settings().unwrap()); let documents = products.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"b01c8371aea4c7171af0d4d846a2bdca"); @@ -324,7 +322,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies.settings()), @"488816aba82c1bd65f1609630055c611"); + insta::assert_json_snapshot!(movies.settings().unwrap()); let documents = movies.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 110); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"786022a66ecb992c8a2a60fee070a5ab"); @@ -339,14 +337,13 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", spells.settings()), @"7b4f66dad597dc651650f35fe34be27f"); + insta::assert_json_snapshot!(spells.settings().unwrap()); let documents = spells.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"235016433dd04262c7f2da01d1e808ce"); } #[test] - #[ignore] fn import_dump_v3() { let dump = File::open("tests/assets/v3.dump").unwrap(); let mut dump = DumpReader::open(dump).unwrap(); @@ -388,7 +385,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", products.settings()), @"855f3165dec609b919171ff83f82b364"); + insta::assert_json_snapshot!(products.settings().unwrap()); let documents = products.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"548284a84de510f71e88e6cdea495cf5"); @@ -403,7 +400,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies.settings()), @"43e0bf1746c3ea1d64c1e10ea544c190"); + insta::assert_json_snapshot!(movies.settings().unwrap()); let documents = movies.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 110); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"d153b5a81d8b3cdcbe1dec270b574022"); @@ -418,7 +415,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies2.settings()), @"5fd06a5038f49311600379d43412b655"); + insta::assert_json_snapshot!(movies2.settings().unwrap()); let documents = movies2.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 0); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"d751713988987e9331980363e24189ce"); @@ -433,14 +430,13 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", spells.settings()), @"5fd06a5038f49311600379d43412b655"); + insta::assert_json_snapshot!(spells.settings().unwrap()); let documents = spells.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"235016433dd04262c7f2da01d1e808ce"); } #[test] - #[ignore] fn import_dump_v2() { let dump = File::open("tests/assets/v2.dump").unwrap(); let mut dump = DumpReader::open(dump).unwrap(); @@ -482,7 +478,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", products.settings()), @"b15b71f56dd082d8e8ec5182e688bf36"); + insta::assert_json_snapshot!(products.settings().unwrap()); let documents = products.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"548284a84de510f71e88e6cdea495cf5"); @@ -497,7 +493,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies.settings()), @"5389153ddf5527fa79c54b6a6e9c21f6"); + insta::assert_json_snapshot!(movies.settings().unwrap()); let documents = movies.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 110); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"d153b5a81d8b3cdcbe1dec270b574022"); @@ -512,7 +508,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies2.settings()), @"8aebab01301d266acf3e18dd449c008f"); + insta::assert_json_snapshot!(movies2.settings().unwrap()); let documents = movies2.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 0); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"d751713988987e9331980363e24189ce"); @@ -527,7 +523,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", spells.settings()), @"8aebab01301d266acf3e18dd449c008f"); + insta::assert_json_snapshot!(spells.settings().unwrap()); let documents = spells.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"235016433dd04262c7f2da01d1e808ce"); diff --git a/dump/src/reader/snapshots/dump__reader__test__import_dump_v2-11.snap b/dump/src/reader/snapshots/dump__reader__test__import_dump_v2-11.snap new file mode 100644 index 000000000..bb9dea24e --- /dev/null +++ b/dump/src/reader/snapshots/dump__reader__test__import_dump_v2-11.snap @@ -0,0 +1,23 @@ +--- +source: dump/src/reader/mod.rs +expression: movies2.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "exactness" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/snapshots/dump__reader__test__import_dump_v2-14.snap b/dump/src/reader/snapshots/dump__reader__test__import_dump_v2-14.snap new file mode 100644 index 000000000..4041a8a53 --- /dev/null +++ b/dump/src/reader/snapshots/dump__reader__test__import_dump_v2-14.snap @@ -0,0 +1,23 @@ +--- +source: dump/src/reader/mod.rs +expression: spells.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "exactness" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/snapshots/dump__reader__test__import_dump_v2-5.snap b/dump/src/reader/snapshots/dump__reader__test__import_dump_v2-5.snap new file mode 100644 index 000000000..242f3096a --- /dev/null +++ b/dump/src/reader/snapshots/dump__reader__test__import_dump_v2-5.snap @@ -0,0 +1,37 @@ +--- +source: dump/src/reader/mod.rs +expression: products.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "exactness" + ], + "stopWords": [], + "synonyms": { + "android": [ + "phone", + "smartphone" + ], + "iphone": [ + "phone", + "smartphone" + ], + "phone": [ + "android", + "iphone", + "smartphone" + ] + }, + "distinctAttribute": null +} diff --git a/dump/src/reader/snapshots/dump__reader__test__import_dump_v2-8.snap b/dump/src/reader/snapshots/dump__reader__test__import_dump_v2-8.snap new file mode 100644 index 000000000..aca28eb2c --- /dev/null +++ b/dump/src/reader/snapshots/dump__reader__test__import_dump_v2-8.snap @@ -0,0 +1,24 @@ +--- +source: dump/src/reader/mod.rs +expression: movies.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "exactness", + "release_date:asc" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/snapshots/dump__reader__test__import_dump_v3-11.snap b/dump/src/reader/snapshots/dump__reader__test__import_dump_v3-11.snap new file mode 100644 index 000000000..645f67e84 --- /dev/null +++ b/dump/src/reader/snapshots/dump__reader__test__import_dump_v3-11.snap @@ -0,0 +1,25 @@ +--- +source: dump/src/reader/mod.rs +expression: movies2.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "sortableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/snapshots/dump__reader__test__import_dump_v3-14.snap b/dump/src/reader/snapshots/dump__reader__test__import_dump_v3-14.snap new file mode 100644 index 000000000..d8a5bafbe --- /dev/null +++ b/dump/src/reader/snapshots/dump__reader__test__import_dump_v3-14.snap @@ -0,0 +1,25 @@ +--- +source: dump/src/reader/mod.rs +expression: spells.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "sortableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/snapshots/dump__reader__test__import_dump_v3-5.snap b/dump/src/reader/snapshots/dump__reader__test__import_dump_v3-5.snap new file mode 100644 index 000000000..abf97a8ab --- /dev/null +++ b/dump/src/reader/snapshots/dump__reader__test__import_dump_v3-5.snap @@ -0,0 +1,39 @@ +--- +source: dump/src/reader/mod.rs +expression: products.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "sortableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ], + "stopWords": [], + "synonyms": { + "android": [ + "phone", + "smartphone" + ], + "iphone": [ + "phone", + "smartphone" + ], + "phone": [ + "android", + "iphone", + "smartphone" + ] + }, + "distinctAttribute": null +} diff --git a/dump/src/reader/snapshots/dump__reader__test__import_dump_v3-8.snap b/dump/src/reader/snapshots/dump__reader__test__import_dump_v3-8.snap new file mode 100644 index 000000000..c1e5d66c6 --- /dev/null +++ b/dump/src/reader/snapshots/dump__reader__test__import_dump_v3-8.snap @@ -0,0 +1,31 @@ +--- +source: dump/src/reader/mod.rs +expression: movies.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [ + "genres", + "id" + ], + "sortableAttributes": [ + "release_date" + ], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness", + "release_date:asc" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/snapshots/dump__reader__test__import_dump_v4-12.snap b/dump/src/reader/snapshots/dump__reader__test__import_dump_v4-12.snap new file mode 100644 index 000000000..ed0e05589 --- /dev/null +++ b/dump/src/reader/snapshots/dump__reader__test__import_dump_v4-12.snap @@ -0,0 +1,34 @@ +--- +source: dump/src/reader/mod.rs +expression: spells.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "sortableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null, + "typoTolerance": { + "enabled": true, + "minWordSizeForTypos": { + "oneTypo": 5, + "twoTypos": 9 + }, + "disableOnWords": [], + "disableOnAttributes": [] + } +} diff --git a/dump/src/reader/snapshots/dump__reader__test__import_dump_v4-6.snap b/dump/src/reader/snapshots/dump__reader__test__import_dump_v4-6.snap new file mode 100644 index 000000000..a0e81767d --- /dev/null +++ b/dump/src/reader/snapshots/dump__reader__test__import_dump_v4-6.snap @@ -0,0 +1,48 @@ +--- +source: dump/src/reader/mod.rs +expression: products.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "sortableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ], + "stopWords": [], + "synonyms": { + "android": [ + "phone", + "smartphone" + ], + "iphone": [ + "phone", + "smartphone" + ], + "phone": [ + "android", + "iphone", + "smartphone" + ] + }, + "distinctAttribute": null, + "typoTolerance": { + "enabled": true, + "minWordSizeForTypos": { + "oneTypo": 5, + "twoTypos": 9 + }, + "disableOnWords": [], + "disableOnAttributes": [] + } +} diff --git a/dump/src/reader/snapshots/dump__reader__test__import_dump_v4-9.snap b/dump/src/reader/snapshots/dump__reader__test__import_dump_v4-9.snap new file mode 100644 index 000000000..3d97b9592 --- /dev/null +++ b/dump/src/reader/snapshots/dump__reader__test__import_dump_v4-9.snap @@ -0,0 +1,40 @@ +--- +source: dump/src/reader/mod.rs +expression: movies.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [ + "genres", + "id" + ], + "sortableAttributes": [ + "release_date" + ], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness", + "release_date:asc" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null, + "typoTolerance": { + "enabled": true, + "minWordSizeForTypos": { + "oneTypo": 5, + "twoTypos": 9 + }, + "disableOnWords": [], + "disableOnAttributes": [] + } +} diff --git a/dump/src/reader/snapshots/dump__reader__test__import_dump_v5-12.snap b/dump/src/reader/snapshots/dump__reader__test__import_dump_v5-12.snap new file mode 100644 index 000000000..4d38f11df --- /dev/null +++ b/dump/src/reader/snapshots/dump__reader__test__import_dump_v5-12.snap @@ -0,0 +1,40 @@ +--- +source: dump/src/reader/mod.rs +expression: spells.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "sortableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null, + "typoTolerance": { + "enabled": true, + "minWordSizeForTypos": { + "oneTypo": 5, + "twoTypos": 9 + }, + "disableOnWords": [], + "disableOnAttributes": [] + }, + "faceting": { + "maxValuesPerFacet": 100 + }, + "pagination": { + "maxTotalHits": 1000 + } +} diff --git a/dump/src/reader/snapshots/dump__reader__test__import_dump_v5-6.snap b/dump/src/reader/snapshots/dump__reader__test__import_dump_v5-6.snap new file mode 100644 index 000000000..3bac0ea0a --- /dev/null +++ b/dump/src/reader/snapshots/dump__reader__test__import_dump_v5-6.snap @@ -0,0 +1,54 @@ +--- +source: dump/src/reader/mod.rs +expression: products.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "sortableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ], + "stopWords": [], + "synonyms": { + "android": [ + "phone", + "smartphone" + ], + "iphone": [ + "phone", + "smartphone" + ], + "phone": [ + "android", + "iphone", + "smartphone" + ] + }, + "distinctAttribute": null, + "typoTolerance": { + "enabled": true, + "minWordSizeForTypos": { + "oneTypo": 5, + "twoTypos": 9 + }, + "disableOnWords": [], + "disableOnAttributes": [] + }, + "faceting": { + "maxValuesPerFacet": 100 + }, + "pagination": { + "maxTotalHits": 1000 + } +} diff --git a/dump/src/reader/snapshots/dump__reader__test__import_dump_v5-9.snap b/dump/src/reader/snapshots/dump__reader__test__import_dump_v5-9.snap new file mode 100644 index 000000000..a8f34b771 --- /dev/null +++ b/dump/src/reader/snapshots/dump__reader__test__import_dump_v5-9.snap @@ -0,0 +1,46 @@ +--- +source: dump/src/reader/mod.rs +expression: movies.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [ + "genres", + "id" + ], + "sortableAttributes": [ + "release_date" + ], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness", + "release_date:asc" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null, + "typoTolerance": { + "enabled": true, + "minWordSizeForTypos": { + "oneTypo": 5, + "twoTypos": 9 + }, + "disableOnWords": [], + "disableOnAttributes": [] + }, + "faceting": { + "maxValuesPerFacet": 100 + }, + "pagination": { + "maxTotalHits": 1000 + } +} diff --git a/dump/src/reader/v2/mod.rs b/dump/src/reader/v2/mod.rs index 3a9e3e587..befebbdb3 100644 --- a/dump/src/reader/v2/mod.rs +++ b/dump/src/reader/v2/mod.rs @@ -211,7 +211,6 @@ pub(crate) mod test { use super::*; #[test] - #[ignore] fn read_dump_v2() { let dump = File::open("tests/assets/v2.dump").unwrap(); let dir = TempDir::new().unwrap(); @@ -257,7 +256,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", products.settings()), @"c41bf7315d404da46c99b9e3a2a3cc1e"); + insta::assert_json_snapshot!(products.settings().unwrap()); let documents = products.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"548284a84de510f71e88e6cdea495cf5"); @@ -272,7 +271,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies.settings()), @"3d1d96c85b6bab46e957bc8d2532a910"); + insta::assert_json_snapshot!(movies.settings().unwrap()); let documents = movies.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 110); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"d153b5a81d8b3cdcbe1dec270b574022"); @@ -287,7 +286,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies2.settings()), @"4f04afc086828d8da0da57a7d598ddba"); + insta::assert_json_snapshot!(movies2.settings().unwrap()); let documents = movies2.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 0); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"d751713988987e9331980363e24189ce"); @@ -302,7 +301,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", spells.settings()), @"4f04afc086828d8da0da57a7d598ddba"); + insta::assert_json_snapshot!(spells.settings().unwrap()); let documents = spells.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"235016433dd04262c7f2da01d1e808ce"); diff --git a/dump/src/reader/v2/snapshots/dump__reader__v2__test__read_dump_v2-11.snap b/dump/src/reader/v2/snapshots/dump__reader__v2__test__read_dump_v2-11.snap new file mode 100644 index 000000000..485e3b2a2 --- /dev/null +++ b/dump/src/reader/v2/snapshots/dump__reader__v2__test__read_dump_v2-11.snap @@ -0,0 +1,23 @@ +--- +source: dump/src/reader/v2/mod.rs +expression: movies2.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "exactness" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/v2/snapshots/dump__reader__v2__test__read_dump_v2-14.snap b/dump/src/reader/v2/snapshots/dump__reader__v2__test__read_dump_v2-14.snap new file mode 100644 index 000000000..08011e92b --- /dev/null +++ b/dump/src/reader/v2/snapshots/dump__reader__v2__test__read_dump_v2-14.snap @@ -0,0 +1,23 @@ +--- +source: dump/src/reader/v2/mod.rs +expression: spells.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "exactness" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/v2/snapshots/dump__reader__v2__test__read_dump_v2-5.snap b/dump/src/reader/v2/snapshots/dump__reader__v2__test__read_dump_v2-5.snap new file mode 100644 index 000000000..2f591818a --- /dev/null +++ b/dump/src/reader/v2/snapshots/dump__reader__v2__test__read_dump_v2-5.snap @@ -0,0 +1,37 @@ +--- +source: dump/src/reader/v2/mod.rs +expression: products.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "exactness" + ], + "stopWords": [], + "synonyms": { + "android": [ + "phone", + "smartphone" + ], + "iphone": [ + "phone", + "smartphone" + ], + "phone": [ + "android", + "iphone", + "smartphone" + ] + }, + "distinctAttribute": null +} diff --git a/dump/src/reader/v2/snapshots/dump__reader__v2__test__read_dump_v2-8.snap b/dump/src/reader/v2/snapshots/dump__reader__v2__test__read_dump_v2-8.snap new file mode 100644 index 000000000..36fad05d7 --- /dev/null +++ b/dump/src/reader/v2/snapshots/dump__reader__v2__test__read_dump_v2-8.snap @@ -0,0 +1,24 @@ +--- +source: dump/src/reader/v2/mod.rs +expression: movies.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "exactness", + "asc(release_date)" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/v3/mod.rs b/dump/src/reader/v3/mod.rs index d363a76f1..5288fb61c 100644 --- a/dump/src/reader/v3/mod.rs +++ b/dump/src/reader/v3/mod.rs @@ -227,7 +227,6 @@ pub(crate) mod test { use super::*; #[test] - #[ignore] fn read_dump_v3() { let dump = File::open("tests/assets/v3.dump").unwrap(); let dir = TempDir::new().unwrap(); @@ -273,7 +272,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", products.settings()), @"f309b009608cc0b770b2f74516f92647"); + insta::assert_json_snapshot!(products.settings().unwrap()); let documents = products.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"548284a84de510f71e88e6cdea495cf5"); @@ -288,7 +287,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies.settings()), @"95dff22ba3a7019616c12df9daa35e1e"); + insta::assert_json_snapshot!(movies.settings().unwrap()); let documents = movies.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 110); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"d153b5a81d8b3cdcbe1dec270b574022"); @@ -303,7 +302,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies2.settings()), @"1dafc4b123e3a8e14a889719cc01f6e5"); + insta::assert_json_snapshot!(movies2.settings().unwrap()); let documents = movies2.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 0); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"d751713988987e9331980363e24189ce"); @@ -318,7 +317,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", spells.settings()), @"1dafc4b123e3a8e14a889719cc01f6e5"); + insta::assert_json_snapshot!(spells.settings().unwrap()); let documents = spells.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"235016433dd04262c7f2da01d1e808ce"); diff --git a/dump/src/reader/v3/snapshots/dump__reader__v3__test__read_dump_v3-11.snap b/dump/src/reader/v3/snapshots/dump__reader__v3__test__read_dump_v3-11.snap new file mode 100644 index 000000000..541c7a61f --- /dev/null +++ b/dump/src/reader/v3/snapshots/dump__reader__v3__test__read_dump_v3-11.snap @@ -0,0 +1,25 @@ +--- +source: dump/src/reader/v3/mod.rs +expression: movies2.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "sortableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/v3/snapshots/dump__reader__v3__test__read_dump_v3-14.snap b/dump/src/reader/v3/snapshots/dump__reader__v3__test__read_dump_v3-14.snap new file mode 100644 index 000000000..b49f285f7 --- /dev/null +++ b/dump/src/reader/v3/snapshots/dump__reader__v3__test__read_dump_v3-14.snap @@ -0,0 +1,25 @@ +--- +source: dump/src/reader/v3/mod.rs +expression: spells.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "sortableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/v3/snapshots/dump__reader__v3__test__read_dump_v3-5.snap b/dump/src/reader/v3/snapshots/dump__reader__v3__test__read_dump_v3-5.snap new file mode 100644 index 000000000..e031bb997 --- /dev/null +++ b/dump/src/reader/v3/snapshots/dump__reader__v3__test__read_dump_v3-5.snap @@ -0,0 +1,39 @@ +--- +source: dump/src/reader/v3/mod.rs +expression: products.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "sortableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ], + "stopWords": [], + "synonyms": { + "android": [ + "phone", + "smartphone" + ], + "iphone": [ + "phone", + "smartphone" + ], + "phone": [ + "android", + "iphone", + "smartphone" + ] + }, + "distinctAttribute": null +} diff --git a/dump/src/reader/v3/snapshots/dump__reader__v3__test__read_dump_v3-8.snap b/dump/src/reader/v3/snapshots/dump__reader__v3__test__read_dump_v3-8.snap new file mode 100644 index 000000000..17dfcff37 --- /dev/null +++ b/dump/src/reader/v3/snapshots/dump__reader__v3__test__read_dump_v3-8.snap @@ -0,0 +1,31 @@ +--- +source: dump/src/reader/v3/mod.rs +expression: movies.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [ + "genres", + "id" + ], + "sortableAttributes": [ + "release_date" + ], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness", + "release_date:asc" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null +} diff --git a/dump/src/reader/v4/mod.rs b/dump/src/reader/v4/mod.rs index 3aad71ddb..30fc27657 100644 --- a/dump/src/reader/v4/mod.rs +++ b/dump/src/reader/v4/mod.rs @@ -219,7 +219,6 @@ pub(crate) mod test { use super::*; #[test] - #[ignore] fn read_dump_v4() { let dump = File::open("tests/assets/v4.dump").unwrap(); let dir = TempDir::new().unwrap(); @@ -269,7 +268,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", products.settings()), @"65b139c6b9fc251e187073c8557803e2"); + insta::assert_json_snapshot!(products.settings().unwrap()); let documents = products.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"b01c8371aea4c7171af0d4d846a2bdca"); @@ -284,7 +283,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies.settings()), @"06aa1988493485d9b2cda7c751e6bb15"); + insta::assert_json_snapshot!(movies.settings().unwrap()); let documents = movies.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 110); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"786022a66ecb992c8a2a60fee070a5ab"); @@ -299,7 +298,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", spells.settings()), @"7d722fc2629eaa45032ed3deb0c9b4ce"); + insta::assert_json_snapshot!(spells.settings().unwrap()); let documents = spells.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"235016433dd04262c7f2da01d1e808ce"); diff --git a/dump/src/reader/v4/snapshots/dump__reader__v4__test__read_dump_v4-10.snap b/dump/src/reader/v4/snapshots/dump__reader__v4__test__read_dump_v4-10.snap new file mode 100644 index 000000000..eaaaefec9 --- /dev/null +++ b/dump/src/reader/v4/snapshots/dump__reader__v4__test__read_dump_v4-10.snap @@ -0,0 +1,40 @@ +--- +source: dump/src/reader/v4/mod.rs +expression: movies.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [ + "genres", + "id" + ], + "sortableAttributes": [ + "release_date" + ], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness", + "release_date:asc" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null, + "typoTolerance": { + "enabled": true, + "minWordSizeForTypos": { + "oneTypo": 5, + "twoTypos": 9 + }, + "disableOnWords": [], + "disableOnAttributes": [] + } +} diff --git a/dump/src/reader/v4/snapshots/dump__reader__v4__test__read_dump_v4-13.snap b/dump/src/reader/v4/snapshots/dump__reader__v4__test__read_dump_v4-13.snap new file mode 100644 index 000000000..af1f4c9b8 --- /dev/null +++ b/dump/src/reader/v4/snapshots/dump__reader__v4__test__read_dump_v4-13.snap @@ -0,0 +1,34 @@ +--- +source: dump/src/reader/v4/mod.rs +expression: spells.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "sortableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ], + "stopWords": [], + "synonyms": {}, + "distinctAttribute": null, + "typoTolerance": { + "enabled": true, + "minWordSizeForTypos": { + "oneTypo": 5, + "twoTypos": 9 + }, + "disableOnWords": [], + "disableOnAttributes": [] + } +} diff --git a/dump/src/reader/v4/snapshots/dump__reader__v4__test__read_dump_v4-7.snap b/dump/src/reader/v4/snapshots/dump__reader__v4__test__read_dump_v4-7.snap new file mode 100644 index 000000000..52aacb204 --- /dev/null +++ b/dump/src/reader/v4/snapshots/dump__reader__v4__test__read_dump_v4-7.snap @@ -0,0 +1,48 @@ +--- +source: dump/src/reader/v4/mod.rs +expression: products.settings().unwrap() +--- +{ + "displayedAttributes": [ + "*" + ], + "searchableAttributes": [ + "*" + ], + "filterableAttributes": [], + "sortableAttributes": [], + "rankingRules": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ], + "stopWords": [], + "synonyms": { + "android": [ + "phone", + "smartphone" + ], + "iphone": [ + "phone", + "smartphone" + ], + "phone": [ + "android", + "iphone", + "smartphone" + ] + }, + "distinctAttribute": null, + "typoTolerance": { + "enabled": true, + "minWordSizeForTypos": { + "oneTypo": 5, + "twoTypos": 9 + }, + "disableOnWords": [], + "disableOnAttributes": [] + } +} diff --git a/dump/src/reader/v5/mod.rs b/dump/src/reader/v5/mod.rs index 2265cbc63..98c6c26dd 100644 --- a/dump/src/reader/v5/mod.rs +++ b/dump/src/reader/v5/mod.rs @@ -261,7 +261,6 @@ pub(crate) mod test { use super::*; #[test] - #[ignore] fn read_dump_v5() { let dump = File::open("tests/assets/v5.dump").unwrap(); let dir = TempDir::new().unwrap(); @@ -312,7 +311,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", products.settings()), @"b392b928dab63468318b2bdaad844c5a"); + insta::assert_json_snapshot!(products.settings().unwrap()); let documents = products.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"b01c8371aea4c7171af0d4d846a2bdca"); @@ -327,7 +326,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", movies.settings()), @"2f881248b7c3623e2ba2885dbf0b2c18"); + insta::assert_json_snapshot!(movies.settings().unwrap()); let documents = movies.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 200); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"e962baafd2fbae4cdd14e876053b0c5a"); @@ -342,7 +341,7 @@ pub(crate) mod test { } "###); - meili_snap::snapshot_hash!(format!("{:#?}", spells.settings()), @"ade154e63ab713de67919892917d3d9d"); + insta::assert_json_snapshot!(spells.settings().unwrap()); let documents = spells.documents().unwrap().collect::>>().unwrap(); assert_eq!(documents.len(), 10); meili_snap::snapshot_hash!(format!("{:#?}", documents), @"235016433dd04262c7f2da01d1e808ce"); diff --git a/dump/src/reader/v5/snapshots/dump__reader__v5__test__read_dump_v5-10.snap b/dump/src/reader/v5/snapshots/dump__reader__v5__test__read_dump_v5-10.snap new file mode 100644 index 000000000..9f34902bb --- /dev/null +++ b/dump/src/reader/v5/snapshots/dump__reader__v5__test__read_dump_v5-10.snap @@ -0,0 +1,74 @@ +--- +source: dump/src/reader/v5/mod.rs +expression: movies.settings().unwrap() +--- +{ + "displayedAttributes": "Reset", + "searchableAttributes": "Reset", + "filterableAttributes": { + "Set": [ + "genres", + "id" + ] + }, + "sortableAttributes": { + "Set": [ + "release_date" + ] + }, + "rankingRules": { + "Set": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness", + "release_date:asc" + ] + }, + "stopWords": { + "Set": [] + }, + "synonyms": { + "Set": {} + }, + "distinctAttribute": "Reset", + "typoTolerance": { + "Set": { + "enabled": { + "Set": true + }, + "minWordSizeForTypos": { + "Set": { + "oneTypo": { + "Set": 5 + }, + "twoTypos": { + "Set": 9 + } + } + }, + "disableOnWords": { + "Set": [] + }, + "disableOnAttributes": { + "Set": [] + } + } + }, + "faceting": { + "Set": { + "maxValuesPerFacet": { + "Set": 100 + } + } + }, + "pagination": { + "Set": { + "maxTotalHits": { + "Set": 1000 + } + } + } +} diff --git a/dump/src/reader/v5/snapshots/dump__reader__v5__test__read_dump_v5-13.snap b/dump/src/reader/v5/snapshots/dump__reader__v5__test__read_dump_v5-13.snap new file mode 100644 index 000000000..639038d36 --- /dev/null +++ b/dump/src/reader/v5/snapshots/dump__reader__v5__test__read_dump_v5-13.snap @@ -0,0 +1,68 @@ +--- +source: dump/src/reader/v5/mod.rs +expression: spells.settings().unwrap() +--- +{ + "displayedAttributes": "Reset", + "searchableAttributes": "Reset", + "filterableAttributes": { + "Set": [] + }, + "sortableAttributes": { + "Set": [] + }, + "rankingRules": { + "Set": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ] + }, + "stopWords": { + "Set": [] + }, + "synonyms": { + "Set": {} + }, + "distinctAttribute": "Reset", + "typoTolerance": { + "Set": { + "enabled": { + "Set": true + }, + "minWordSizeForTypos": { + "Set": { + "oneTypo": { + "Set": 5 + }, + "twoTypos": { + "Set": 9 + } + } + }, + "disableOnWords": { + "Set": [] + }, + "disableOnAttributes": { + "Set": [] + } + } + }, + "faceting": { + "Set": { + "maxValuesPerFacet": { + "Set": 100 + } + } + }, + "pagination": { + "Set": { + "maxTotalHits": { + "Set": 1000 + } + } + } +} diff --git a/dump/src/reader/v5/snapshots/dump__reader__v5__test__read_dump_v5-7.snap b/dump/src/reader/v5/snapshots/dump__reader__v5__test__read_dump_v5-7.snap new file mode 100644 index 000000000..b37af6de7 --- /dev/null +++ b/dump/src/reader/v5/snapshots/dump__reader__v5__test__read_dump_v5-7.snap @@ -0,0 +1,82 @@ +--- +source: dump/src/reader/v5/mod.rs +expression: products.settings().unwrap() +--- +{ + "displayedAttributes": "Reset", + "searchableAttributes": "Reset", + "filterableAttributes": { + "Set": [] + }, + "sortableAttributes": { + "Set": [] + }, + "rankingRules": { + "Set": [ + "words", + "typo", + "proximity", + "attribute", + "sort", + "exactness" + ] + }, + "stopWords": { + "Set": [] + }, + "synonyms": { + "Set": { + "android": [ + "phone", + "smartphone" + ], + "iphone": [ + "phone", + "smartphone" + ], + "phone": [ + "android", + "iphone", + "smartphone" + ] + } + }, + "distinctAttribute": "Reset", + "typoTolerance": { + "Set": { + "enabled": { + "Set": true + }, + "minWordSizeForTypos": { + "Set": { + "oneTypo": { + "Set": 5 + }, + "twoTypos": { + "Set": 9 + } + } + }, + "disableOnWords": { + "Set": [] + }, + "disableOnAttributes": { + "Set": [] + } + } + }, + "faceting": { + "Set": { + "maxValuesPerFacet": { + "Set": 100 + } + } + }, + "pagination": { + "Set": { + "maxTotalHits": { + "Set": 1000 + } + } + } +} diff --git a/dump/src/writer.rs b/dump/src/writer.rs index 29aa2508d..c11cf6b9a 100644 --- a/dump/src/writer.rs +++ b/dump/src/writer.rs @@ -259,7 +259,6 @@ pub(crate) mod test { } #[test] - #[ignore] fn test_creating_dump() { let file = create_test_dump(); let mut file = BufReader::new(file); @@ -296,7 +295,7 @@ pub(crate) mod test { insta::assert_json_snapshot!(metadata, { ".dumpDate" => "[date]" }, @r###" { "dumpVersion": "V6", - "dbVersion": "0.29.0", + "dbVersion": "0.30.0", "dumpDate": "[date]" } "###);