Adding upstream version 0.31.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
091495b2f3
commit
5d4914ed7f
61 changed files with 30627 additions and 0 deletions
75
features_test.go
Normal file
75
features_test.go
Normal file
|
@ -0,0 +1,75 @@
|
|||
package meilisearch
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestGet_ExperimentalFeatures(t *testing.T) {
|
||||
sv := setup(t, "")
|
||||
customSv := setup(t, "", WithCustomClientWithTLS(&tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
}))
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
client ServiceManager
|
||||
}{
|
||||
{
|
||||
name: "TestGetStats",
|
||||
client: sv,
|
||||
},
|
||||
{
|
||||
name: "TestGetStatsWithCustomClient",
|
||||
client: customSv,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
ef := tt.client.ExperimentalFeatures()
|
||||
gotResp, err := ef.Get()
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, gotResp, "ExperimentalFeatures.Get() should not return nil value")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdate_ExperimentalFeatures(t *testing.T) {
|
||||
sv := setup(t, "")
|
||||
customSv := setup(t, "", WithCustomClientWithTLS(&tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
}))
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
client ServiceManager
|
||||
}{
|
||||
{
|
||||
name: "TestUpdateStats",
|
||||
client: sv,
|
||||
},
|
||||
{
|
||||
name: "TestUpdateStatsWithCustomClient",
|
||||
client: customSv,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
ef := tt.client.ExperimentalFeatures()
|
||||
ef.SetLogsRoute(true)
|
||||
ef.SetMetrics(true)
|
||||
ef.SetEditDocumentsByFunction(true)
|
||||
ef.SetContainsFilter(true)
|
||||
gotResp, err := ef.Update()
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, true, gotResp.LogsRoute, "ExperimentalFeatures.Update() should return logsRoute as true")
|
||||
require.Equal(t, true, gotResp.Metrics, "ExperimentalFeatures.Update() should return metrics as true")
|
||||
require.Equal(t, true, gotResp.EditDocumentsByFunction, "ExperimentalFeatures.Update() should return editDocumentsByFunction as true")
|
||||
require.Equal(t, true, gotResp.ContainsFilter, "ExperimentalFeatures.Update() should return containsFilter as true")
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue