diff options
author | 2024-06-14 12:14:55 +0200 | |
---|---|---|
committer | 2024-06-14 10:14:55 +0000 | |
commit | db803617db5621f33f6f1c16e05ae187f0e3ddbb (patch) | |
tree | c1724ed5c12e3194b8a0bf4e46809bdd2bc3ebd0 /internal/db/bundb/notification_test.go | |
parent | [feature] filter API v2: Restore keywords_attributes and statuses_attributes ... (diff) | |
download | gotosocial-db803617db5621f33f6f1c16e05ae187f0e3ddbb.tar.xz |
[bugfix] avoid v. long notification clear query (#3007)v0.16.0-rc3
Diffstat (limited to 'internal/db/bundb/notification_test.go')
-rw-r--r-- | internal/db/bundb/notification_test.go | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/internal/db/bundb/notification_test.go b/internal/db/bundb/notification_test.go index 9cc2e4743..984c0ef8d 100644 --- a/internal/db/bundb/notification_test.go +++ b/internal/db/bundb/notification_test.go @@ -73,7 +73,7 @@ func (suite *NotificationTestSuite) spamNotifs() { Read: util.Ptr(false), } - if err := suite.db.Put(context.Background(), notif); err != nil { + if err := suite.db.PutNotification(context.Background(), notif); err != nil { panic(err) } } @@ -133,9 +133,8 @@ func (suite *NotificationTestSuite) TestGetAccountNotificationsWithoutSpam() { func (suite *NotificationTestSuite) TestDeleteNotificationsWithSpam() { suite.spamNotifs() testAccount := suite.testAccounts["local_account_1"] - err := suite.db.DeleteNotifications(context.Background(), nil, testAccount.ID, "") - suite.NoError(err) + // Test getting notifs first. notifications, err := suite.db.GetAccountNotifications( gtscontext.SetBarebones(context.Background()), testAccount.ID, @@ -145,8 +144,29 @@ func (suite *NotificationTestSuite) TestDeleteNotificationsWithSpam() { 20, nil, ) - suite.NoError(err) - suite.Nil(notifications) + if err != nil { + suite.FailNow(err.Error()) + } + suite.Len(notifications, 20) + + // Now delete. + if err := suite.db.DeleteNotifications(context.Background(), nil, testAccount.ID, ""); err != nil { + suite.FailNow(err.Error()) + } + + // Now try getting again. + notifications, err = suite.db.GetAccountNotifications( + gtscontext.SetBarebones(context.Background()), + testAccount.ID, + id.Highest, + id.Lowest, + "", + 20, + nil, + ) + if err != nil { + suite.FailNow(err.Error()) + } suite.Empty(notifications) } |