Skip to content

Commit ae3f536

Browse files
committed
t - Add test case
Test using both scrubber and file extension options
1 parent 32d5677 commit ae3f536

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

scrubber_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ func TestVerifyMapWithRegexScrubber(t *testing.T) {
3535
approvals.VerifyMap(t, m, opts)
3636
}
3737

38+
func TestVerifyMapWithScrubberAndExtension(t *testing.T) {
39+
scrubber, _ := regexp.Compile("\\d{10}$")
40+
opts := approvals.Options().WithRegexScrubber(scrubber, "<time>").WithExtension(".customExt")
41+
42+
m := map[string]string{
43+
"dog": "bark",
44+
"cat": "meow",
45+
"time": fmt.Sprint(time.Now().Unix()),
46+
}
47+
approvals.VerifyMap(t, m, opts)
48+
}
49+
3850
func TestVerifyArrayWithRegexScrubber(t *testing.T) {
3951
scrubber, _ := regexp.Compile("cat")
4052
opts := approvals.Options().WithRegexScrubber(scrubber, "person")
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[cat]=meow
2+
[dog]=bark
3+
[time]=<time>

0 commit comments

Comments
 (0)