-
-
Notifications
You must be signed in to change notification settings - Fork 177
Expand file tree
/
Copy pathcursor_test.go
More file actions
34 lines (27 loc) · 688 Bytes
/
cursor_test.go
File metadata and controls
34 lines (27 loc) · 688 Bytes
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
package rethinkdb
import (
test "gopkg.in/check.v1"
"gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests"
)
type CursorSuite struct{}
var _ = test.Suite(&CursorSuite{})
func (s *CursorSuite) TestCursor_One_Ok(c *test.C) {
data := map[string]interface{}{
"A": 1,
"B": true,
}
mock := NewMock()
ch := make(chan []interface{})
mock.On(DB("test").Table("test")).Return(ch, nil)
go func() {
ch <- []interface{}{data}
close(ch)
}()
res, err := DB("test").Table("test").Run(mock)
c.Assert(err, test.IsNil)
var response interface{}
err = res.One(&response)
c.Assert(err, test.IsNil)
c.Assert(response, tests.JsonEquals, data)
mock.AssertExpectations(c)
}