From 5811260d83896dcec407936a5f54eb70e6772cb9 Mon Sep 17 00:00:00 2001 From: Rogee Date: Fri, 14 Aug 2026 19:06:31 +0800 Subject: [PATCH] H-127: align Captain inbox repository fixture (#20) Co-authored-by: Rogee --- backend/internal/repository/captain_inbox_repo_test.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/backend/internal/repository/captain_inbox_repo_test.go b/backend/internal/repository/captain_inbox_repo_test.go index 37bec04e..e19b5312 100644 --- a/backend/internal/repository/captain_inbox_repo_test.go +++ b/backend/internal/repository/captain_inbox_repo_test.go @@ -128,17 +128,15 @@ func TestCaptainInboxRepo_FindByInboxID(t *testing.T) { db := setupTestDB(t, &model.CaptainInbox{}) repo := NewCaptainInboxRepo(db) - // Create multiple assistants linked to the same inbox + // Create bindings for different inboxes. An inbox has at most one active assistant. ci1 := newTestCaptainInbox(6, 60, 600) - ci2 := newTestCaptainInbox(7, 60, 600) // same inbox, different assistant - ci3 := newTestCaptainInbox(8, 61, 600) // different inbox + ci2 := newTestCaptainInbox(7, 61, 600) require.NoError(t, repo.Create(context.Background(), ci1)) require.NoError(t, repo.Create(context.Background(), ci2)) - require.NoError(t, repo.Create(context.Background(), ci3)) inboxes, err := repo.FindByInboxID(context.Background(), 60) require.NoError(t, err) - assert.Len(t, inboxes, 2, "should return 2 entries for inbox 60") + assert.Len(t, inboxes, 1, "should return the entry for inbox 60") // Verify all results belong to the correct inbox for _, ci := range inboxes { @@ -153,4 +151,4 @@ func TestCaptainInboxRepo_FindByInboxID_Empty(t *testing.T) { inboxes, err := repo.FindByInboxID(context.Background(), 999) require.NoError(t, err) assert.Empty(t, inboxes, "should return empty list for non-existent inbox") -} \ No newline at end of file +}