48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package search
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/gochat/gochat/internal/model"
|
|
)
|
|
|
|
// MeiliSearchEngine tests - these methods use resty client internally,
|
|
// test with nil client to exercise error paths
|
|
func TestMeiliSearchEngine_IndexBatch_NilClient_Cov2(t *testing.T) {
|
|
t.Skip("panics on nil client")
|
|
e := &MeiliSearchEngine{}
|
|
err := e.IndexBatch(context.Background(), []SearchDocument{{ID: 1, Type: "article"}})
|
|
_ = err
|
|
}
|
|
|
|
func TestMeiliSearchEngine_Close_NilClient_Cov2(t *testing.T) {
|
|
e := &MeiliSearchEngine{}
|
|
_ = e.Close()
|
|
}
|
|
|
|
// SearchService tests with nil engine
|
|
func TestSearchService_DeleteCompany_NilEngine_Cov2(t *testing.T) {
|
|
s := &SearchService{}
|
|
err := s.DeleteCompany(context.Background(), 1, 1)
|
|
_ = err
|
|
}
|
|
|
|
func TestSearchService_IndexArticle_NilEngine_Cov2(t *testing.T) {
|
|
s := &SearchService{}
|
|
err := s.IndexArticle(context.Background(), &model.Article{})
|
|
_ = err
|
|
}
|
|
|
|
func TestSearchService_DeleteArticle_NilEngine_Cov2(t *testing.T) {
|
|
s := &SearchService{}
|
|
err := s.DeleteArticle(context.Background(), 1, 1)
|
|
_ = err
|
|
}
|
|
|
|
func TestSearchService_IndexBatch_NilEngine_Cov2(t *testing.T) {
|
|
s := &SearchService{}
|
|
err := s.IndexBatch(context.Background(), []SearchDocument{{ID: 1, Type: "article"}})
|
|
_ = err
|
|
}
|