-
Notifications
You must be signed in to change notification settings - Fork 72
/
search_test.go
49 lines (44 loc) · 1.19 KB
/
search_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
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT license.
// Details in the LICENSE file.
package trello
import (
"testing"
)
func TestSearchCards(t *testing.T) {
c := testClient()
c.BaseURL = mockResponse("search", "cards-api-example-response.json").URL
cards, err := c.SearchCards("testQuery", Defaults())
if err != nil {
t.Fatal(err)
}
if len(cards) != 1 {
t.Errorf("Expected 1 card search result. Got %d.", len(cards))
}
if cards[0].client == nil {
t.Errorf("Card struct in result has no client info")
}
}
func TestSearchBoards(t *testing.T) {
c := testClient()
c.BaseURL = mockResponse("search", "boards-api-example-response.json").URL
boards, err := c.SearchBoards("testQuery", Defaults())
if err != nil {
t.Fatal(err)
}
if len(boards) != 1 {
t.Errorf("Expected 1 board search result. Got %d.", len(boards))
}
}
func TestSearchMembers(t *testing.T) {
c := testClient()
c.BaseURL = mockResponse("search", "members-api-example-response.json").URL
members, err := c.SearchMembers("testQuery", Defaults())
if err != nil {
t.Fatal(err)
}
if len(members) != 3 {
t.Errorf("Expected 3 member search result entries. Got %d.", len(members))
}
}