Skip to content

Commit

Permalink
Use different tests for redactions (#578)
Browse files Browse the repository at this point in the history
They're currently pointing to the same test file with different
expressions, which causes volatile results given the `id`s are different
  • Loading branch information
max-sixty authored Sep 1, 2024
1 parent 597199d commit ef7abb8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
source: tests/test_redaction.rs
expression: "&User {\n id: 11,\n username: \"john_doe\".to_string(),\n email: Email(\"john@example.com\".to_string()),\n extra: \"\".to_string(),\n }"
source: insta/tests/test_redaction.rs
expression: "&User {\n id: 42,\n username: \"john_doe\".to_string(),\n email: Email(\"john@example.com\".to_string()),\n extra: \"\".to_string(),\n }"
---
id: "[id]"
username: john_doe
email: john@example.com
extra: ""

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
source: insta/tests/test_redaction.rs
expression: "&User {\n id: 23,\n username: \"john_doe\".to_string(),\n email: Email(\"john@example.com\".to_string()),\n extra: \"\".to_string(),\n }"
---
id: "[id]"
username: john_doe
email: john@example.com
extra: ""
6 changes: 3 additions & 3 deletions insta/tests/test_redaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub struct User {
#[cfg(feature = "yaml")]
#[test]
fn test_with_random_value() {
assert_yaml_snapshot!("user", &User {
assert_yaml_snapshot!(&User {
id: 42,
username: "john_doe".to_string(),
email: Email("john@example.com".to_string()),
Expand All @@ -59,7 +59,7 @@ fn test_with_random_value() {
#[cfg(feature = "yaml")]
#[test]
fn test_with_random_value_inline_callback() {
assert_yaml_snapshot!("user", &User {
assert_yaml_snapshot!(&User {
id: 23,
username: "john_doe".to_string(),
email: Email("john@example.com".to_string()),
Expand All @@ -76,7 +76,7 @@ fn test_with_random_value_inline_callback() {
#[cfg(feature = "yaml")]
#[test]
fn test_with_random_value_and_trailing_comma() {
assert_yaml_snapshot!("user", &User {
assert_yaml_snapshot!(&User {
id: 11,
username: "john_doe".to_string(),
email: Email("john@example.com".to_string()),
Expand Down

0 comments on commit ef7abb8

Please sign in to comment.