24 lines
670 B
Go
24 lines
670 B
Go
package listunsubscribe
|
|
|
|
import "testing"
|
|
|
|
func TestParse_mailtoHeader(t *testing.T) {
|
|
got := Parse("<mailto:opposition@vertical-mail.com>")
|
|
if got.Mailto == nil || got.Mailto.Address != "opposition@vertical-mail.com" {
|
|
t.Fatalf("Parse() mailto = %+v", got.Mailto)
|
|
}
|
|
}
|
|
|
|
func TestParse_mailtoWithHttp(t *testing.T) {
|
|
got := Parse("<mailto:a@b.com?subject=unsub>, <https://example.com/unsub>")
|
|
if got.Mailto == nil || got.Mailto.Address != "a@b.com" {
|
|
t.Fatalf("mailto = %+v", got.Mailto)
|
|
}
|
|
if got.Mailto.Subject != "unsub" {
|
|
t.Fatalf("subject = %q", got.Mailto.Subject)
|
|
}
|
|
if got.HTTP != "https://example.com/unsub" {
|
|
t.Fatalf("http = %q", got.HTTP)
|
|
}
|
|
}
|