forked from ivahaev/amigo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
amigo_test.go
52 lines (50 loc) · 1.49 KB
/
amigo_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
50
51
52
package amigo
import (
"testing"
)
func TestAmigo(t *testing.T) {
t.Run("#New", func(t *testing.T) {
t.Run("should return pointer to a new Amigo struct with username and password filled and default host and port settings", func(t *testing.T) {
a := New(&Settings{Username: "username", Password: "secret"})
if a.username != "username" {
t.Fatal("username mismatched")
}
if a.secret != "secret" {
t.Fatal("secret mismatched")
}
})
t.Run("should return pointer to a new Amigo struct with username and password filled and provided host and default port settings", func(t *testing.T) {
a := New(&Settings{Username: "username", Password: "secret", Host: "amigo"})
if a.username != "username" {
t.Fatal("username mismatched")
}
if a.secret != "secret" {
t.Fatal("secret mismatched")
}
if a.secret != "secret" {
t.Fatal("secret mismatched")
}
if a.host != "amigo" {
t.Fatal("host mismatched")
}
})
t.Run("should return pointer to a new Amigo struct with username, password, host and port filled", func(t *testing.T) {
a := New(&Settings{Username: "username", Password: "secret", Host: "amigo", Port: "666"})
if a.username != "username" {
t.Fatal("username mismatched")
}
if a.secret != "secret" {
t.Fatal("secret mismatched")
}
if a.secret != "secret" {
t.Fatal("secret mismatched")
}
if a.host != "amigo" {
t.Fatal("host mismatched")
}
if a.port != "666" {
t.Fatal("port mismatched")
}
})
})
}