-
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 := "example@service.com;example2@service.com"
if len(recipients) < 2 {
t.Errorf("It has more than recipient email")
}
}
func TestExtractMultipleRecipients(t *testing.T) {
recipients := "example@service.com;example2@service.com"
extracted_recipients_email, _ := ExtractRecipientEmailsFromArgument(recipients)
expected_output := []string{"example@service.com", "example2@service.com"}
if !reflect.DeepEqual(extracted_recipients_email, expected_output) {
t.Errorf("Invalid recipients. See: %v", extracted_recipients_email)
}
}
func TestExtractSingleRecipient(t *testing.T) {
recipients := "example@service.com"
extracted_recipients_email, _ := ExtractRecipientEmailsFromArgument(recipients)
expected_output := []string{"example@service.com"}
if !reflect.DeepEqual(extracted_recipients_email, expected_output) {
t.Errorf("invalid recipient. see: %v", extracted_recipients_email)
}
}