优化
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user