From 4075739fec2cb65a9dab76525ab535e07ca827e2 Mon Sep 17 00:00:00 2001 From: LinkinStar Date: Fri, 18 Nov 2022 16:52:05 +0800 Subject: [PATCH] fix: repo test set notification userID to correct --- internal/repo/repo_test/notification_repo_test.go | 2 +- internal/repo/repo_test/repo_main_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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 {