fleet/server/fleet/emails_test.go
Martin Angers 2e8da551d0
Custom email device-mapping: implement the CLI (fleetd + fleetctl) changes (#15763)
Co-authored-by: Sarah Gillespie <73313222+gillespi314@users.noreply.github.com>
2023-12-21 11:22:59 -06:00

28 lines
497 B
Go

package fleet
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestIsLooseEmail(t *testing.T) {
testCases := []struct {
str string
match bool
}{
{"foo", false},
{"", false},
{"foo@example", false},
{"foo@example.com", true},
{"foo+bar@example.com", true},
{"foo.bar@example.com", true},
{"foo.bar@baz.example.com", true},
}
for _, tc := range testCases {
t.Run(tc.str, func(t *testing.T) {
assert.Equal(t, tc.match, IsLooseEmail(tc.str))
})
}
}