Skip to content

Commit

Permalink
Merge pull request #111 from americanexpress/fix/ssn
Browse files Browse the repository at this point in the history
fix(ssn): updated ssn rule to ignore flaging 9xx in third group
  • Loading branch information
utsavmaniyar authored May 20, 2024
2 parents 15520cf + 2230817 commit 3d32db9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/postprocess/validateSSN.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func ValidSSN(ssn string) bool {
if len(groups) != 3 {
return false
}
if first, _ := strconv.Atoi(groups[0]); first == 666 || first <= 0 || first > 999 {
if first, _ := strconv.Atoi(groups[0]); first == 666 || first <= 0 || first > 900 {
return false
} else if second, _ := strconv.Atoi(groups[1]); second <= 0 || second > 99 {
return false
Expand Down
10 changes: 10 additions & 0 deletions pkg/postprocess/validateSSN_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ func TestValidSSN(t *testing.T) {
ssn: "666-000-0000",
want: false,
},
{
name: "Test invalid SSN",
ssn: "900-000-0000",
want: false,
},
{
name: "Test invalid SSN",
ssn: "999-000-0000",
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 3d32db9

Please sign in to comment.