diff options
| author | 2024-06-05 21:40:08 +0200 | |
|---|---|---|
| committer | 2024-06-05 21:40:08 +0200 | |
| commit | 9caf29bed25bb9315327e44de4a4863bd494596c (patch) | |
| tree | 308987f53fbc954aec0c972693c919269d603216 /internal | |
| parent | Compile filter keyword regexps when touched through PutFilter or UpdateFilter... (diff) | |
| download | gotosocial-9caf29bed25bb9315327e44de4a4863bd494596c.tar.xz | |
[chore] Fiddle with CI tests; use wasmsqlite3 for CI tests (#2966)
* [chore] Update CI test stuff
* don't bother with ldflags
* use wasmsqlite3
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/db/bundb/notification_test.go | 48 | 
1 files changed, 40 insertions, 8 deletions
diff --git a/internal/db/bundb/notification_test.go b/internal/db/bundb/notification_test.go index 83c3ef041..9cc2e4743 100644 --- a/internal/db/bundb/notification_test.go +++ b/internal/db/bundb/notification_test.go @@ -20,12 +20,12 @@ package bundb_test  import (  	"context"  	"errors" -	"fmt"  	"testing"  	"time"  	"github.com/stretchr/testify/suite"  	"github.com/superseriousbusiness/gotosocial/internal/db" +	"github.com/superseriousbusiness/gotosocial/internal/gtscontext"  	"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"  	"github.com/superseriousbusiness/gotosocial/internal/id"  	"github.com/superseriousbusiness/gotosocial/internal/util" @@ -78,7 +78,7 @@ func (suite *NotificationTestSuite) spamNotifs() {  		}  	} -	fmt.Printf("\n\n\nput %d notifs in the db\n\n\n", notifCount) +	suite.T().Logf("put %d notifs in the db\n", notifCount)  }  type NotificationTestSuite struct { @@ -89,10 +89,18 @@ func (suite *NotificationTestSuite) TestGetAccountNotificationsWithSpam() {  	suite.spamNotifs()  	testAccount := suite.testAccounts["local_account_1"]  	before := time.Now() -	notifications, err := suite.db.GetAccountNotifications(context.Background(), testAccount.ID, id.Highest, id.Lowest, "", 20, nil) +	notifications, err := suite.db.GetAccountNotifications( +		gtscontext.SetBarebones(context.Background()), +		testAccount.ID, +		id.Highest, +		id.Lowest, +		"", +		20, +		nil, +	)  	suite.NoError(err)  	timeTaken := time.Since(before) -	fmt.Printf("\n\n\n withSpam: got %d notifications in %s\n\n\n", len(notifications), timeTaken) +	suite.T().Logf("withSpam: got %d notifications in %s\n", len(notifications), timeTaken)  	suite.NotNil(notifications)  	for _, n := range notifications { @@ -103,10 +111,18 @@ func (suite *NotificationTestSuite) TestGetAccountNotificationsWithSpam() {  func (suite *NotificationTestSuite) TestGetAccountNotificationsWithoutSpam() {  	testAccount := suite.testAccounts["local_account_1"]  	before := time.Now() -	notifications, err := suite.db.GetAccountNotifications(context.Background(), testAccount.ID, id.Highest, id.Lowest, "", 20, nil) +	notifications, err := suite.db.GetAccountNotifications( +		gtscontext.SetBarebones(context.Background()), +		testAccount.ID, +		id.Highest, +		id.Lowest, +		"", +		20, +		nil, +	)  	suite.NoError(err)  	timeTaken := time.Since(before) -	fmt.Printf("\n\n\n withoutSpam: got %d notifications in %s\n\n\n", len(notifications), timeTaken) +	suite.T().Logf("withoutSpam: got %d notifications in %s\n", len(notifications), timeTaken)  	suite.NotNil(notifications)  	for _, n := range notifications { @@ -120,7 +136,15 @@ func (suite *NotificationTestSuite) TestDeleteNotificationsWithSpam() {  	err := suite.db.DeleteNotifications(context.Background(), nil, testAccount.ID, "")  	suite.NoError(err) -	notifications, err := suite.db.GetAccountNotifications(context.Background(), testAccount.ID, id.Highest, id.Lowest, "", 20, nil) +	notifications, err := suite.db.GetAccountNotifications( +		gtscontext.SetBarebones(context.Background()), +		testAccount.ID, +		id.Highest, +		id.Lowest, +		"", +		20, +		nil, +	)  	suite.NoError(err)  	suite.Nil(notifications)  	suite.Empty(notifications) @@ -132,7 +156,15 @@ func (suite *NotificationTestSuite) TestDeleteNotificationsWithTwoAccounts() {  	err := suite.db.DeleteNotifications(context.Background(), nil, testAccount.ID, "")  	suite.NoError(err) -	notifications, err := suite.db.GetAccountNotifications(context.Background(), testAccount.ID, id.Highest, id.Lowest, "", 20, nil) +	notifications, err := suite.db.GetAccountNotifications( +		gtscontext.SetBarebones(context.Background()), +		testAccount.ID, +		id.Highest, +		id.Lowest, +		"", +		20, +		nil, +	)  	suite.NoError(err)  	suite.Nil(notifications)  	suite.Empty(notifications)  | 
