fix: repo test set notification userID to correct

This commit is contained in:
LinkinStar 2022-11-18 16:52:05 +08:00
parent 0c1a77d52c
commit 4075739fec
2 changed files with 3 additions and 2 deletions

View File

@ -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)

View File

@ -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 {