-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
49 lines (37 loc) 路 1.27 KB
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"reflect"
"testing"
)
func TestGetFullServiceAddress(t *testing.T) {
service_address := ServiceAddress{
"stmp.example.com",
"587",
}
full_service_address, _ := service_address.GetFullServiceAddress()
if full_service_address != "stmp.example.com:587" {
t.Errorf("Service address is not valid!")
}
}
func TestHasMoreThanOneRecipient(t *testing.T) {
recipients := "[email protected];[email protected]"
if len(recipients) < 2 {
t.Errorf("It has more than recipient email")
}
}
func TestExtractMultipleRecipients(t *testing.T) {
recipients := "[email protected];[email protected]"
extracted_recipients_email, _ := ExtractRecipientEmailsFromArgument(recipients)
expected_output := []string{"[email protected]", "[email protected]"}
if !reflect.DeepEqual(extracted_recipients_email, expected_output) {
t.Errorf("Invalid recipients. See: %v", extracted_recipients_email)
}
}
func TestExtractSingleRecipient(t *testing.T) {
recipients := "[email protected]"
extracted_recipients_email, _ := ExtractRecipientEmailsFromArgument(recipients)
expected_output := []string{"[email protected]"}
if !reflect.DeepEqual(extracted_recipients_email, expected_output) {
t.Errorf("invalid recipient. see: %v", extracted_recipients_email)
}
}