-
Notifications
You must be signed in to change notification settings - Fork 23
/
condition_test.go
55 lines (45 loc) · 1006 Bytes
/
condition_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
package kinesis
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func TestString(t *testing.T) {
assert := assert.New(t)
tests := []struct {
iterator string
expected string
}{
{"A", "A"},
{"ABC", "ABC"},
{"", "LATEST"},
{"LATEST", "LATEST"},
{string(IteratorTypeLatest), "LATEST"},
{string(IteratorTypeTrimHorizon), "TRIM_HORIZON"},
}
for _, tt := range tests {
target := fmt.Sprintf("%+v", tt)
it := IteratorType(tt.iterator)
assert.Equal(tt.iterator, string(it), target)
assert.Equal(tt.expected, it.String(), target)
}
}
func TestIsEmpty(t *testing.T) {
assert := assert.New(t)
tests := []struct {
iterator string
expected bool
}{
{"", true},
{"A", false},
{"ABC", false},
{"LATEST", false},
{string(IteratorTypeLatest), false},
{string(IteratorTypeTrimHorizon), false},
}
for _, tt := range tests {
target := fmt.Sprintf("%+v", tt)
it := IteratorType(tt.iterator)
assert.Equal(tt.expected, it.isEmpty(), target)
}
}