forked from cloudant-labs/go-cloudant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchanges_query_test.go
56 lines (50 loc) · 1.03 KB
/
changes_query_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
package cloudant
import (
"strings"
"testing"
)
func TestChangesQuery_Args(t *testing.T) {
// Conflicts bool
// Descending bool
// Feed string
// Filter string
// Heartbeat int
// IncludeDocs bool
// Limit int
// SeqInterval int
// Since string
// Style string
// Timeout int
expectedQueryStrings := []string{
"conflicts=true",
"descending=true",
"feed=continuous",
"filter=_doc_ids",
"heartbeat=5",
"include_docs=true",
"limit=2",
"since=somerandomdatashouldbeSEQ",
"style=alldocs",
"timeout=10",
}
query := NewChangesQuery().
Conflicts().
Descending().
Feed("continuous").
Filter("_doc_ids").
Heartbeat(5).
IncludeDocs().
Limit(2).
Since("somerandomdatashouldbeSEQ").
Style("alldocs").
Timeout(10).
Build()
values, _ := query.GetQuery()
queryString := values.Encode()
for _, str := range expectedQueryStrings {
if !strings.Contains(queryString, str) {
t.Errorf("parameter encoding not found '%s' in '%s'", str, queryString)
return
}
}
}