-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathrequestbuilder_test.go
More file actions
28 lines (22 loc) · 858 Bytes
/
requestbuilder_test.go
File metadata and controls
28 lines (22 loc) · 858 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
package yaorm
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestBuildSelectColumns(t *testing.T) {
bs := buildSelectColumns{}
assert.Equal(t, []string{"a", "b", "c"}, bs.reduce([]string{"a", "b", "c"}),
"no filter on columns")
bs = buildSelectColumns{dontLoadColumns: []string{"c", "d"}}
assert.Equal(t, []string{"a", "b"}, bs.reduce([]string{"a", "b", "c"}),
"do not use c, d columns")
bs = buildSelectColumns{loadColumns: []string{"b", "c", "d"}}
assert.Equal(t, []string{"b", "c"}, bs.reduce([]string{"a", "b", "c"}),
"only use b, c, d columns")
bs = buildSelectColumns{
loadColumns: []string{"b", "c", "d", "g"},
dontLoadColumns: []string{"b", "e", "f"},
}
assert.Equal(t, []string{"c", "d"}, bs.reduce([]string{"a", "b", "c", "d", "e"}),
"only use b, c, d, g columns, BUT do not use b, e, f columns")
}