This commit is contained in:
2026-08-17 02:39:40 +08:00
parent 6a05803e08
commit d09e6b42bd
16 changed files with 74 additions and 19 deletions
+19
View File
@@ -38,3 +38,22 @@ func TestAnnouncementRepositoryKeepsRawIDQuerySemantics(t *testing.T) {
t.Fatalf("raw invalid ID removed rows: count=%d", count)
}
}
func TestAnnouncementRepositoryPreservesSignedUserID(t *testing.T) {
data := newTransactionTestData(t)
repo := &announcementRepo{data: data}
ctx := context.Background()
userID := -1
item := &biz.Announcement{Title: "notice", UserID: &userID}
if err := repo.Create(ctx, item); err != nil {
t.Fatal(err)
}
found, err := repo.Find(ctx, "1")
if err != nil {
t.Fatal(err)
}
if found.UserID == nil || *found.UserID != userID {
t.Fatalf("found user ID = %v, want %d", found.UserID, userID)
}
}