refactor(user): decouple repository from direct database infra import

This commit is contained in:
ryan
2026-08-28 13:37:13 +08:00
parent 3570ccd5c3
commit a296818922
5 changed files with 90 additions and 48 deletions
+4 -1
View File
@@ -36,7 +36,10 @@ func setupTestDB(t *testing.T) *gorm.DB {
func TestUserPluginUnit(t *testing.T) {
ctx := core.NewContext(context.Background())
_ = setupTestDB(t)
testDB := setupTestDB(t)
dbPlugin := database.New(database.WithDB(testDB))
require.NoError(t, dbPlugin.Apply(ctx))
p := user.New()
assert.Equal(t, "user", p.Name())