-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmessage_test.go
More file actions
57 lines (55 loc) · 1.02 KB
/
Copy pathmessage_test.go
File metadata and controls
57 lines (55 loc) · 1.02 KB
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 wavecell
import (
"testing"
)
func TestForSingleMessageValidation(t *testing.T) {
tests := []struct {
reference string
from string
to string
err error
}{
{
reference: "#1",
from: "",
to: "",
err: ErrForFromNonAlphanumeric,
},
{
reference: "#2",
from: "111111111111111",
to: "",
err: ErrForFromNonAlphanumeric,
},
{
reference: "#3",
from: "invalid1111111",
to: "",
err: ErrForFromAlphanumeric,
},
{
reference: "#4",
from: "valid",
to: "111111111111111",
err: ErrForToNonAlphanumeric,
},
{
reference: "#5",
from: "442071838750",
to: "14155552671",
err: nil,
},
}
for _, test := range tests {
test := test
t.Run(test.reference, func(t *testing.T) {
m := Message{
From: test.from,
To: test.to,
}
if err := m.Validate(); err != test.err {
t.Errorf("Error: expected '%s', got '%s'", test.err, err)
}
})
}
}