Replace individual snapshots with a Vec snapshot.
This commit is contained in:
parent
52fb210268
commit
471656abc5
25
tests/lib.rs
25
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]
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
source: tests/lib.rs
|
||||
expression: urls
|
||||
---
|
||||
[
|
||||
"https://www.gravatar.com/avatar/ecd836ee843ff0ab75d4720bd40c2baf",
|
||||
"https://www.gravatar.com/avatar/ebff9105dce4954b1bdb57fdab079ff3",
|
||||
]
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
source: tests/lib.rs
|
||||
expression: urls
|
||||
---
|
||||
[
|
||||
"https://cdn.libravatar.org/avatar/ecd836ee843ff0ab75d4720bd40c2baf",
|
||||
"https://cdn.libravatar.org/avatar/ebff9105dce4954b1bdb57fdab079ff3",
|
||||
]
|
|
@ -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",
|
||||
],
|
||||
),
|
||||
]
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
source: tests/lib.rs
|
||||
expression: "Generator::hash_email(&email.to_uppercase())"
|
||||
---
|
||||
ecd836ee843ff0ab75d4720bd40c2baf
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
source: tests/lib.rs
|
||||
expression: "Generator::hash_email(&format!(\" {email} \"))"
|
||||
---
|
||||
ecd836ee843ff0ab75d4720bd40c2baf
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
source: tests/lib.rs
|
||||
expression: "Generator::hash_email(email)"
|
||||
---
|
||||
ecd836ee843ff0ab75d4720bd40c2baf
|
|
@ -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",
|
||||
),
|
||||
]
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
source: tests/lib.rs
|
||||
expression: "Generator::hash_email(&email.to_uppercase())"
|
||||
---
|
||||
ebff9105dce4954b1bdb57fdab079ff3
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
source: tests/lib.rs
|
||||
expression: "Generator::hash_email(&format!(\" {email} \"))"
|
||||
---
|
||||
ebff9105dce4954b1bdb57fdab079ff3
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
source: tests/lib.rs
|
||||
expression: "Generator::hash_email(email)"
|
||||
---
|
||||
ebff9105dce4954b1bdb57fdab079ff3
|
Loading…
Reference in New Issue