mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-16 21:14:36 +00:00
@@ -1,7 +1,6 @@
|
||||
package handler_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/google/uuid"
|
||||
@@ -15,7 +14,7 @@ func TestUpdateConversation(t *testing.T) {
|
||||
|
||||
// seed some data
|
||||
var cRsp pb.CreateConversationResponse
|
||||
err := h.CreateConversation(context.TODO(), &pb.CreateConversationRequest{
|
||||
err := h.CreateConversation(microAccountCtx(), &pb.CreateConversationRequest{
|
||||
Topic: "HelloWorld", GroupId: uuid.New().String(),
|
||||
}, &cRsp)
|
||||
if err != nil {
|
||||
@@ -24,21 +23,21 @@ func TestUpdateConversation(t *testing.T) {
|
||||
}
|
||||
|
||||
t.Run("MissingID", func(t *testing.T) {
|
||||
err := h.UpdateConversation(context.TODO(), &pb.UpdateConversationRequest{
|
||||
err := h.UpdateConversation(microAccountCtx(), &pb.UpdateConversationRequest{
|
||||
Topic: "NewTopic",
|
||||
}, &pb.UpdateConversationResponse{})
|
||||
assert.Equal(t, handler.ErrMissingID, err)
|
||||
})
|
||||
|
||||
t.Run("MissingTopic", func(t *testing.T) {
|
||||
err := h.UpdateConversation(context.TODO(), &pb.UpdateConversationRequest{
|
||||
err := h.UpdateConversation(microAccountCtx(), &pb.UpdateConversationRequest{
|
||||
Id: uuid.New().String(),
|
||||
}, &pb.UpdateConversationResponse{})
|
||||
assert.Equal(t, handler.ErrMissingTopic, err)
|
||||
})
|
||||
|
||||
t.Run("InvalidID", func(t *testing.T) {
|
||||
err := h.UpdateConversation(context.TODO(), &pb.UpdateConversationRequest{
|
||||
err := h.UpdateConversation(microAccountCtx(), &pb.UpdateConversationRequest{
|
||||
Id: uuid.New().String(),
|
||||
Topic: "NewTopic",
|
||||
}, &pb.UpdateConversationResponse{})
|
||||
@@ -46,14 +45,14 @@ func TestUpdateConversation(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("Valid", func(t *testing.T) {
|
||||
err := h.UpdateConversation(context.TODO(), &pb.UpdateConversationRequest{
|
||||
err := h.UpdateConversation(microAccountCtx(), &pb.UpdateConversationRequest{
|
||||
Id: cRsp.Conversation.Id,
|
||||
Topic: "NewTopic",
|
||||
}, &pb.UpdateConversationResponse{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
var rsp pb.ReadConversationResponse
|
||||
err = h.ReadConversation(context.TODO(), &pb.ReadConversationRequest{
|
||||
err = h.ReadConversation(microAccountCtx(), &pb.ReadConversationRequest{
|
||||
Id: cRsp.Conversation.Id,
|
||||
}, &rsp)
|
||||
assert.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user