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
+7 -5
View File
@@ -408,8 +408,8 @@ func TestMessageService_Send_AttachmentTooLarge_Total(t *testing.T) {
// Use config with smaller maxMsg to make the test reliable.
cfg := defaultMsgConfig()
cfg.MaxFileBytes = 50 * 1024 * 1024 // 50 MB per file — both pass individually
cfg.MaxMsgBytes = 40 * 1024 * 1024 // 40 MB total — 60 MB fails
cfg.MaxFileBytes = 50 * 1024 * 1024 // 50 MB per file — both pass individually
cfg.MaxMsgBytes = 40 * 1024 * 1024 // 40 MB total — 60 MB fails
svc := buildMessageService(repo, hub, cfg)
_, _, err := svc.Send(context.Background(), userID, conv.ID, "hi", []uuid.UUID{a1.ID, a2.ID})
@@ -621,7 +621,7 @@ func TestMessageService_Retry_NotRetriable(t *testing.T) {
repo.addMessage(m)
svc := buildMessageService(repo, hub, defaultMsgConfig())
_, err := svc.Retry(context.Background(), userID, 55)
_, _, err := svc.Retry(context.Background(), userID, 55)
require.Error(t, err)
var ae *errs.AppError
@@ -641,10 +641,11 @@ func TestMessageService_Retry_HappyPath(t *testing.T) {
repo.addMessage(old)
svc := buildMessageService(repo, hub, defaultMsgConfig())
newID, err := svc.Retry(context.Background(), userID, 10)
newID, convID, err := svc.Retry(context.Background(), userID, 10)
require.NoError(t, err)
require.Greater(t, newID, int64(0))
require.Equal(t, conv.ID, convID)
// Old message deleted.
repo.mu.Lock()
@@ -681,10 +682,11 @@ func TestMessageService_Retry_Cancelled_HappyPath(t *testing.T) {
repo.addMessage(old)
svc := buildMessageService(repo, hub, defaultMsgConfig())
newID, err := svc.Retry(context.Background(), userID, 11)
newID, convID, err := svc.Retry(context.Background(), userID, 11)
require.NoError(t, err)
require.Greater(t, newID, int64(0))
require.Equal(t, conv.ID, convID)
}
// ===== Stream tests =====