store md5 instead of the whole snapshots

This commit is contained in:
Tamo 2022-10-11 19:43:50 +02:00 committed by Clément Renault
parent d85451b8e5
commit 974b40ba04
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
134 changed files with 136 additions and 44497 deletions

View file

@ -400,7 +400,7 @@ pub(crate) mod test {
// tasks
let tasks = dump.tasks().collect::<Result<Vec<_>>>().unwrap();
let (tasks, update_files): (Vec<_>, Vec<_>) = tasks.into_iter().unzip();
insta::assert_json_snapshot!(tasks);
meili_snap::snapshot_hash!(meili_snap::json_string!(tasks), @"");
assert_eq!(update_files.len(), 22);
assert!(update_files[0].is_none()); // the dump creation
assert!(update_files[1].is_some()); // the enqueued document addition
@ -408,7 +408,7 @@ pub(crate) mod test {
// keys
let keys = dump.keys().collect::<Result<Vec<_>>>().unwrap();
insta::assert_json_snapshot!(keys);
meili_snap::snapshot_hash!(meili_snap::json_string!(keys), @"");
// indexes
let mut indexes = dump.indexes().unwrap().collect::<Result<Vec<_>>>().unwrap();
@ -430,14 +430,14 @@ pub(crate) mod test {
}
"###);
insta::assert_debug_snapshot!(products.settings());
meili_snap::snapshot_hash!(format!("{:#?}", products.settings()), @"");
let documents = products
.documents()
.unwrap()
.collect::<Result<Vec<_>>>()
.unwrap();
assert_eq!(documents.len(), 10);
insta::assert_json_snapshot!(documents);
meili_snap::snapshot_hash!(format!("{:#?}", documents), @"");
// movies
insta::assert_json_snapshot!(movies.metadata(), { ".createdAt" => "[now]", ".updatedAt" => "[now]" }, @r###"
@ -449,14 +449,14 @@ pub(crate) mod test {
}
"###);
insta::assert_debug_snapshot!(movies.settings());
meili_snap::snapshot_hash!(format!("{:#?}", movies.settings()), @"");
let documents = movies
.documents()
.unwrap()
.collect::<Result<Vec<_>>>()
.unwrap();
assert_eq!(documents.len(), 200);
insta::assert_debug_snapshot!(documents);
meili_snap::snapshot_hash!(format!("{:#?}", documents), @"");
// spells
insta::assert_json_snapshot!(spells.metadata(), { ".createdAt" => "[now]", ".updatedAt" => "[now]" }, @r###"
@ -468,13 +468,13 @@ pub(crate) mod test {
}
"###);
insta::assert_debug_snapshot!(spells.settings());
meili_snap::snapshot_hash!(format!("{:#?}", spells.settings()), @"");
let documents = spells
.documents()
.unwrap()
.collect::<Result<Vec<_>>>()
.unwrap();
assert_eq!(documents.len(), 10);
insta::assert_json_snapshot!(documents);
meili_snap::snapshot_hash!(format!("{:#?}", documents), @"");
}
}