Add test for SearchMsg function when no chatLogs in database

pull/864/head
sweep-ai[bot] 2 years ago committed by GitHub
parent a24e00db6c
commit 2e861a6929
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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…
Cancel
Save