-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathformatError_test.go
57 lines (46 loc) · 1006 Bytes
/
formatError_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
53
54
55
56
57
package gpc
import (
"testing"
)
func TestFormatError(action *testing.T) {
action.Run("Should be TestFormatError - value is not struct", func(t *testing.T) {
var (
payload string = "hello world"
_, err = Validator(payload)
)
if err == nil {
t.FailNow()
}
})
action.Run("Should be TestFormatError - is empty struct", func(t *testing.T) {
var (
payload struct{} = struct{}{}
_, err = Validator(payload)
)
if err == nil {
t.FailNow()
}
})
action.Run("Should be TestFormatError - not empty value", func(t *testing.T) {
var (
payload = Login{Email: "", Password: ""}
res, err = Validator(payload)
)
if err != nil {
t.FailNow()
}
if res == nil {
t.FailNow()
}
})
action.Run("Should be TestFormatError - success", func(t *testing.T) {
payload := Login{Email: "[email protected]", Password: "qwerty12"}
res, err := Validator(payload)
if err != nil {
t.FailNow()
}
if res != nil {
t.FailNow()
}
})
}