diff --git a/tests/lib.rs b/tests/lib.rs index b5ff096..9b4ec96 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -6,23 +6,23 @@ const HOLLLO_EMAIL: &str = "helllo@holllo.cc"; #[test] fn test_hash_email() { let samples = [("bauke", BAUKE_EMAIL), ("holllo", HOLLLO_EMAIL)]; + let mut snapshot = vec![]; for (name, email) in samples { - insta::assert_snapshot!( - format!("hash-{name}"), - Generator::hash_email(email) - ); + snapshot.push((format!("hash-{name}"), Generator::hash_email(email))); - insta::assert_snapshot!( + snapshot.push(( format!("hash-{name}-whitespace"), - Generator::hash_email(&format!(" {email} ")) - ); + Generator::hash_email(&format!(" {email} ")), + )); - insta::assert_snapshot!( + snapshot.push(( format!("hash-{name}-casing"), - Generator::hash_email(&email.to_uppercase()) - ); + Generator::hash_email(&email.to_uppercase()), + )); } + + insta::assert_debug_snapshot!("hash-email", snapshot); } #[test] @@ -32,12 +32,15 @@ fn test_generator() { ("gravatar", Generator::default().base_url), ("libravatar", "cdn.libravatar.org".to_string()), ]; + let mut snapshot = vec![]; for (name, base_url) in samples { let generator = Generator::default().set_base_url(&base_url); let urls = emails.map(|email| generator.generate(email)); - insta::assert_debug_snapshot!(format!("generate-{name}"), urls); + snapshot.push((format!("generate-{name}"), urls)); } + + insta::assert_debug_snapshot!("generator", snapshot); } #[test] diff --git a/tests/snapshots/lib__generate-gravatar.snap b/tests/snapshots/lib__generate-gravatar.snap deleted file mode 100644 index 3226a1f..0000000 --- a/tests/snapshots/lib__generate-gravatar.snap +++ /dev/null @@ -1,8 +0,0 @@ ---- -source: tests/lib.rs -expression: urls ---- -[ - "https://www.gravatar.com/avatar/ecd836ee843ff0ab75d4720bd40c2baf", - "https://www.gravatar.com/avatar/ebff9105dce4954b1bdb57fdab079ff3", -] diff --git a/tests/snapshots/lib__generate-libravatar.snap b/tests/snapshots/lib__generate-libravatar.snap deleted file mode 100644 index 42a259e..0000000 --- a/tests/snapshots/lib__generate-libravatar.snap +++ /dev/null @@ -1,8 +0,0 @@ ---- -source: tests/lib.rs -expression: urls ---- -[ - "https://cdn.libravatar.org/avatar/ecd836ee843ff0ab75d4720bd40c2baf", - "https://cdn.libravatar.org/avatar/ebff9105dce4954b1bdb57fdab079ff3", -] diff --git a/tests/snapshots/lib__generator.snap b/tests/snapshots/lib__generator.snap new file mode 100644 index 0000000..9df732c --- /dev/null +++ b/tests/snapshots/lib__generator.snap @@ -0,0 +1,20 @@ +--- +source: tests/lib.rs +expression: snapshot +--- +[ + ( + "generate-gravatar", + [ + "https://www.gravatar.com/avatar/ecd836ee843ff0ab75d4720bd40c2baf", + "https://www.gravatar.com/avatar/ebff9105dce4954b1bdb57fdab079ff3", + ], + ), + ( + "generate-libravatar", + [ + "https://cdn.libravatar.org/avatar/ecd836ee843ff0ab75d4720bd40c2baf", + "https://cdn.libravatar.org/avatar/ebff9105dce4954b1bdb57fdab079ff3", + ], + ), +] diff --git a/tests/snapshots/lib__hash-bauke-casing.snap b/tests/snapshots/lib__hash-bauke-casing.snap deleted file mode 100644 index 3014d41..0000000 --- a/tests/snapshots/lib__hash-bauke-casing.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: tests/lib.rs -expression: "Generator::hash_email(&email.to_uppercase())" ---- -ecd836ee843ff0ab75d4720bd40c2baf diff --git a/tests/snapshots/lib__hash-bauke-whitespace.snap b/tests/snapshots/lib__hash-bauke-whitespace.snap deleted file mode 100644 index 02de210..0000000 --- a/tests/snapshots/lib__hash-bauke-whitespace.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: tests/lib.rs -expression: "Generator::hash_email(&format!(\" {email} \"))" ---- -ecd836ee843ff0ab75d4720bd40c2baf diff --git a/tests/snapshots/lib__hash-bauke.snap b/tests/snapshots/lib__hash-bauke.snap deleted file mode 100644 index 421b045..0000000 --- a/tests/snapshots/lib__hash-bauke.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: tests/lib.rs -expression: "Generator::hash_email(email)" ---- -ecd836ee843ff0ab75d4720bd40c2baf diff --git a/tests/snapshots/lib__hash-email.snap b/tests/snapshots/lib__hash-email.snap new file mode 100644 index 0000000..f2cba91 --- /dev/null +++ b/tests/snapshots/lib__hash-email.snap @@ -0,0 +1,30 @@ +--- +source: tests/lib.rs +expression: snapshot +--- +[ + ( + "hash-bauke", + "ecd836ee843ff0ab75d4720bd40c2baf", + ), + ( + "hash-bauke-whitespace", + "ecd836ee843ff0ab75d4720bd40c2baf", + ), + ( + "hash-bauke-casing", + "ecd836ee843ff0ab75d4720bd40c2baf", + ), + ( + "hash-holllo", + "ebff9105dce4954b1bdb57fdab079ff3", + ), + ( + "hash-holllo-whitespace", + "ebff9105dce4954b1bdb57fdab079ff3", + ), + ( + "hash-holllo-casing", + "ebff9105dce4954b1bdb57fdab079ff3", + ), +] diff --git a/tests/snapshots/lib__hash-holllo-casing.snap b/tests/snapshots/lib__hash-holllo-casing.snap deleted file mode 100644 index a331c20..0000000 --- a/tests/snapshots/lib__hash-holllo-casing.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: tests/lib.rs -expression: "Generator::hash_email(&email.to_uppercase())" ---- -ebff9105dce4954b1bdb57fdab079ff3 diff --git a/tests/snapshots/lib__hash-holllo-whitespace.snap b/tests/snapshots/lib__hash-holllo-whitespace.snap deleted file mode 100644 index 20a7ff8..0000000 --- a/tests/snapshots/lib__hash-holllo-whitespace.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: tests/lib.rs -expression: "Generator::hash_email(&format!(\" {email} \"))" ---- -ebff9105dce4954b1bdb57fdab079ff3 diff --git a/tests/snapshots/lib__hash-holllo.snap b/tests/snapshots/lib__hash-holllo.snap deleted file mode 100644 index b0b18a7..0000000 --- a/tests/snapshots/lib__hash-holllo.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: tests/lib.rs -expression: "Generator::hash_email(email)" ---- -ebff9105dce4954b1bdb57fdab079ff3