Skip to content

Commit ef7abb8

Browse files
authored
Use different tests for redactions (#578)
They're currently pointing to the same test file with different expressions, which causes volatile results given the `id`s are different
1 parent 597199d commit ef7abb8

4 files changed

+13
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
---
2-
source: tests/test_redaction.rs
3-
expression: "&User {\n id: 11,\n username: \"john_doe\".to_string(),\n email: Email(\"[email protected]\".to_string()),\n extra: \"\".to_string(),\n }"
2+
source: insta/tests/test_redaction.rs
3+
expression: "&User {\n id: 42,\n username: \"john_doe\".to_string(),\n email: Email(\"[email protected]\".to_string()),\n extra: \"\".to_string(),\n }"
44
---
55
id: "[id]"
66
username: john_doe
77
email: john@example.com
88
extra: ""
9-
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
source: insta/tests/test_redaction.rs
3+
expression: "&User {\n id: 23,\n username: \"john_doe\".to_string(),\n email: Email(\"[email protected]\".to_string()),\n extra: \"\".to_string(),\n }"
4+
---
5+
id: "[id]"
6+
username: john_doe
7+
email: john@example.com
8+
extra: ""

insta/tests/test_redaction.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub struct User {
4646
#[cfg(feature = "yaml")]
4747
#[test]
4848
fn test_with_random_value() {
49-
assert_yaml_snapshot!("user", &User {
49+
assert_yaml_snapshot!(&User {
5050
id: 42,
5151
username: "john_doe".to_string(),
5252
email: Email("[email protected]".to_string()),
@@ -59,7 +59,7 @@ fn test_with_random_value() {
5959
#[cfg(feature = "yaml")]
6060
#[test]
6161
fn test_with_random_value_inline_callback() {
62-
assert_yaml_snapshot!("user", &User {
62+
assert_yaml_snapshot!(&User {
6363
id: 23,
6464
username: "john_doe".to_string(),
6565
email: Email("[email protected]".to_string()),
@@ -76,7 +76,7 @@ fn test_with_random_value_inline_callback() {
7676
#[cfg(feature = "yaml")]
7777
#[test]
7878
fn test_with_random_value_and_trailing_comma() {
79-
assert_yaml_snapshot!("user", &User {
79+
assert_yaml_snapshot!(&User {
8080
id: 11,
8181
username: "john_doe".to_string(),
8282
email: Email("[email protected]".to_string()),

0 commit comments

Comments
 (0)