-
Notifications
You must be signed in to change notification settings - Fork 10
/
config_test.go
60 lines (52 loc) · 1.3 KB
/
config_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
57
58
59
60
package solr_test
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stevenferrer/solr-go"
)
func TestBuildComponent(t *testing.T) {
got := solr.NewComponent(solr.SearchComponent).
Name("suggest").Class("solr.SearchComponent").
Config(solr.M{
"lookupImpl": "AnalyzingInfixLookupFactory",
"dictionaryImpl": "DocumentDictionaryFactory",
"field": "suggest",
"suggestAnalyzerFieldType": "suggext_text",
}).BuildComponent()
expect := solr.M{
"name": "suggest",
"class": "solr.SearchComponent",
"lookupImpl": "AnalyzingInfixLookupFactory",
"dictionaryImpl": "DocumentDictionaryFactory",
"field": "suggest",
"suggestAnalyzerFieldType": "suggext_text",
}
assert.Equal(t, expect, got)
}
func TestComponentTypeStringer(t *testing.T) {
var tests = []struct {
componentType solr.ComponentType
expected string
}{
{
solr.RequestHandler,
"requesthandler",
},
{
solr.SearchComponent,
"searchcomponent",
},
{
solr.InitParams,
"initparams",
},
{
solr.QueryResponseWriter,
"queryresponsewriter",
},
}
for _, test := range tests {
got := test.componentType.String()
assert.Equal(t, test.expected, got)
}
}