Files

30 lines
748 B
Go

package cli
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestParseRecipients(t *testing.T) {
tests := []struct {
input string
expected []string
}{
{"", nil},
{"[email protected]", []string{"[email protected]"}},
{"[email protected],[email protected]", []string{"[email protected]", "[email protected]"}},
{"[email protected], [email protected]", []string{"[email protected]", "[email protected]"}},
{" [email protected] , [email protected] ", []string{"[email protected]", "[email protected]"}},
{"[email protected],,[email protected]", []string{"[email protected]", "[email protected]"}},
{" , , ", []string{}},
}
for _, tt := range tests {
t.Run(tt.input, func(t *testing.T) {
got := parseRecipients(tt.input)
assert.Equal(t, tt.expected, got)
})
}
}