24 lines
471 B
Go
24 lines
471 B
Go
package monetix
|
|
|
|
import "testing"
|
|
|
|
func TestMaskPAN(t *testing.T) {
|
|
cases := []struct {
|
|
input string
|
|
expected string
|
|
}{
|
|
{input: "1234", expected: "****"},
|
|
{input: "1234567890", expected: "12******90"},
|
|
{input: "1234567890123456", expected: "123456******3456"},
|
|
}
|
|
|
|
for _, tc := range cases {
|
|
t.Run(tc.input, func(t *testing.T) {
|
|
got := MaskPAN(tc.input)
|
|
if got != tc.expected {
|
|
t.Fatalf("expected %q, got %q", tc.expected, got)
|
|
}
|
|
})
|
|
}
|
|
}
|