H-127: align Captain inbox repository fixture (#20)

Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
Rogee
2026-08-14 19:06:31 +08:00
committed by GitHub
co-authored by rogee
parent c922460649
commit 5811260d83
@@ -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")
}
}