-
Notifications
You must be signed in to change notification settings - Fork 1
/
findcommand_test.go
42 lines (36 loc) · 1.01 KB
/
findcommand_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
package filemaker
import "testing"
func TestFindCommand(t *testing.T) {
t.Run("NewFindCommand", func(t *testing.T) {
command := NewFindCommand()
if command == nil {
t.Errorf("got: %v, expected: %v", command, "not nil")
}
})
t.Run("Limit", func(t *testing.T) {
command := NewFindCommand().Limit(10)
if command["limit"] != 10 {
t.Errorf("got: %v, expected: %v", command["limit"], 10)
}
})
t.Run("Offset", func(t *testing.T) {
command := NewFindCommand().Offset(10)
if command["offset"] != 10 {
t.Errorf("got: %v, expected: %v", command["offset"], 10)
}
})
t.Run("Sort", func(t *testing.T) {
command := NewFindCommand().Sort("fieldName", SortAscending)
if command["sort"] == nil {
t.Errorf("got: %v, expected: %v", command["sort"], "not nil")
}
})
t.Run("AddRequest", func(t *testing.T) {
command := NewFindCommand()
request := NewFindRequest()
command.AddRequest(request)
if command["query"] == nil {
t.Errorf("got: %v, expected: %v", command["query"], "not nil")
}
})
}