Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: repo test set notification userID to correct

LinkinStard833cadae25d
diff --git a/internal/repo/repo_test/notification_repo_test.go b/internal/repo/repo_test/notification_repo_test.go
index e07255a5..778b1a33 100644
--- a/internal/repo/repo_test/notification_repo_test.go
+++ b/internal/repo/repo_test/notification_repo_test.go
@@ -81,7 +81,7 @@ func Test_notificationRepo_GetNotificationPage(t *testing.T) {
err := notificationRepo.AddNotification(context.TODO(), ent)
assert.NoError(t, err)
- notificationPage, total, err := notificationRepo.GetNotificationPage(context.TODO(), &schema.NotificationSearch{UserID: userID})
+ notificationPage, total, err := notificationRepo.GetNotificationPage(context.TODO(), &schema.NotificationSearch{UserID: ent.UserID})
assert.NoError(t, err)
assert.True(t, total > 0)
assert.Equal(t, notificationPage[0].UserID, ent.UserID)
diff --git a/internal/repo/repo_test/repo_main_test.go b/internal/repo/repo_test/repo_main_test.go
index e67223ff..8fcd8cec 100644
--- a/internal/repo/repo_test/repo_main_test.go
+++ b/internal/repo/repo_test/repo_main_test.go
@@ -52,7 +52,8 @@ var (
func TestMain(t *testing.M) {
dbSetting, ok := dbSettingMapping[os.Getenv("TEST_DB_DRIVER")]
if !ok {
- dbSetting = dbSettingMapping[string(schemas.MYSQL)]
+ // Use sqlite3 to test.
+ dbSetting = dbSettingMapping[string(schemas.SQLITE)]
}
defer func() {
if tearDown != nil {