Skip to content

Commit

Permalink
add test for SPF too long error
Browse files Browse the repository at this point in the history
  • Loading branch information
lenaunderwood22 committed Jul 1, 2024
1 parent 4af21e5 commit c33b8cc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/spf/record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,14 @@ func TestCompareRecords(t *testing.T) {
}
}
}

func TestSPFTooLongError(t *testing.T) {
spfRecord := "v=spf1 " + strings.Repeat("a", 2042)
if err := UpdateSPFRecord("mydomain", spfRecord, "", "", ""); !strings.HasPrefix(err.Error(), "SPF record is too long") {
t.Fatalf("expected to fail since SPF record is too long")
}
spfRecord = "v=spf1 " + strings.Repeat("a", 2041)
if err := UpdateSPFRecord("mydomain", spfRecord, "", "", ""); strings.HasPrefix(err.Error(), "SPF record is too long") {
t.Fatalf("unexpected `SPF record is too long` error")
}
}

0 comments on commit c33b8cc

Please sign in to comment.