-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
* feat: implement dictionaries API methods Co-authored-by: Chloe Liban <chloe.liban@gmail.com> Co-authored-by: Jérôme Schneider <jerome.schneider@algolia.com>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Code generated by go generate. DO NOT EDIT. | ||
|
||
package opt | ||
|
||
import ( | ||
"encoding/json" | ||
"testing" | ||
|
||
"github.com/algolia/algoliasearch-client-go/v3/algolia/opt" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestExtract{{ .Name }}(t *testing.T) { | ||
for _, c := range []struct { | ||
opts []interface{} | ||
expected *opt.{{ .Name }}Option | ||
}{ | ||
{ | ||
opts: []interface{}{nil}, | ||
expected: opt.{{ .Name }}({{ .DefaultValue }}), | ||
}, | ||
{ | ||
opts: []interface{}{opt.{{ .Name }}(map[string]map[string]bool{})}, | ||
expected: opt.{{ .Name }}(map[string]map[string]bool{}), | ||
}, | ||
{ | ||
opts: []interface{}{opt.{{ .Name }}(map[string]map[string]bool{"outer1": map[string]bool{"k1": true, "k2": false}, "outer2": map[string]bool{"k3": true}})}, | ||
expected: opt.{{ .Name }}(map[string]map[string]bool{"outer1": map[string]bool{"k1": true, "k2": false}, "outer2": map[string]bool{"k3": true}}), | ||
}, | ||
} { | ||
var ( | ||
in = Extract{{ .Name }}(c.opts...) | ||
out opt.{{ .Name }}Option | ||
) | ||
data, err := json.Marshal(&in) | ||
require.NoError(t, err) | ||
err = json.Unmarshal(data, &out) | ||
require.NoError(t, err) | ||
require.Equal(t, *c.expected, out) | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.