-
Notifications
You must be signed in to change notification settings - Fork 0
/
new_test.go
45 lines (34 loc) · 992 Bytes
/
new_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
package timberemail
import (
"testing"
)
func TestNewShouldReturnWriter(t *testing.T) {
result := New("test", "from", "password", []string{"to"}, "localhost", 25)
if result == nil {
t.Errorf("should return valid io.Writer, got: nil")
}
}
func TestNewShouldReturnNilWithoutFrom(t *testing.T) {
result := New("", "", "", []string{"to"}, "host", 25)
if result != nil {
t.Errorf("should return nil, got: %v", result)
}
}
func TestNewShouldReturnNilWithoutTo(t *testing.T) {
result := New("", "from", "", []string{}, "host", 25)
if result != nil {
t.Errorf("should return nil, got: %v", result)
}
}
func TestNewShouldReturnNilWithoutHost(t *testing.T) {
result := New("", "from", "", []string{"to"}, "", 25)
if result != nil {
t.Errorf("should return nil, got: %v", result)
}
}
func TestNewShouldReturnNilWithoutPort(t *testing.T) {
result := New("", "from", "", []string{"to"}, "host", 0)
if result != nil {
t.Errorf("should return nil, got: %v", result)
}
}