This commit is contained in:
2026-06-10 07:55:16 +08:00
parent 821eca9f0c
commit aaac7e9d98
31 changed files with 548 additions and 149 deletions
+6 -2
View File
@@ -118,6 +118,10 @@ func (r *convFakeRepo) SoftDeleteConversation(_ context.Context, id uuid.UUID) e
return nil
}
func (r *convFakeRepo) ListAttachmentsForMessage(_ context.Context, _ int64) ([]Attachment, error) {
return nil, nil
}
func (r *convFakeRepo) ListMessagesByConversation(_ context.Context, convID uuid.UUID, _ *int64, limit int) ([]Message, error) {
r.mu.Lock()
defer r.mu.Unlock()
@@ -335,7 +339,7 @@ func TestConversationService_Get_HappyPath(t *testing.T) {
{ID: 1, ConversationID: conv.ID, Role: RoleUser, Content: "hello"},
}
got, msgs, err := svc.Get(context.Background(), userID, conv.ID)
got, msgs, err := svc.Get(context.Background(), userID, conv.ID, 50)
require.NoError(t, err)
require.NotNil(t, got)
assert.Equal(t, conv.ID, got.ID)
@@ -350,7 +354,7 @@ func TestConversationService_Get_NotOwner(t *testing.T) {
callerID := uuid.Must(uuid.NewV7())
conv := addConversation(repo, ownerID)
_, _, err := svc.Get(context.Background(), callerID, conv.ID)
_, _, err := svc.Get(context.Background(), callerID, conv.ID, 50)
require.Error(t, err)
var appErr *errs.AppError
require.ErrorAs(t, err, &appErr)