mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-17 11:39:14 +08:00
Add test for SearchMsg function when no chatLogs in database
This commit is contained in:
parent
a24e00db6c
commit
2e861a6929
25
internal/rpc/msg/search_test.go
Normal file
25
internal/rpc/msg/search_test.go
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package msg
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
"github.com/OpenIMSDK/Open-IM-Server/internal/logic/service"
|
||||||
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestSearchMsg(t *testing.T) {
|
||||||
|
// Ensure that the database is empty
|
||||||
|
// clearDatabase()
|
||||||
|
|
||||||
|
// Call the SearchMsg function
|
||||||
|
req := &pb.SearchMsgReq{}
|
||||||
|
resp, err := service.NewMsgService().SearchMsg(context.Background(), req)
|
||||||
|
|
||||||
|
// Check that the error is nil and the response is empty
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Expected nil error, got %v", err)
|
||||||
|
}
|
||||||
|
if resp != &pb.SearchMsgResp{} {
|
||||||
|
t.Errorf("Expected empty response, got %v", resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user