feat(audit): sanitize stored upstream responses

This commit is contained in:
2026-09-21 11:10:01 +03:30
parent 22d67c7c36
commit 14df432175
5 changed files with 145 additions and 0 deletions

View File

@@ -53,3 +53,35 @@ func TestValidate(t *testing.T) {
})
}
}
func TestMask(t *testing.T) {
tests := []struct {
name string
number string
want string
}{
{
name: "valid card number",
number: "6037997512345678",
want: "603799******5678",
},
{
name: "invalid card number",
number: "603799",
want: "",
},
{
name: "non numeric card number",
number: "603799ABC2345678",
want: "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := Mask(tt.number); got != tt.want {
t.Errorf("Mask() = %q, want %q", got, tt.want)
}
})
}
}