Set default prefix in Prepare function for test environment

- Added logic to set a default prefix of "yao_" for the application if none is provided, ensuring consistent naming conventions in the test setup.
This commit is contained in:
Max 2025-07-16 17:05:05 +08:00
parent d5dd0f56c7
commit 57d61c1ba3

View file

@ -187,6 +187,11 @@ func Prepare(t *testing.T, cfg config.Config, rootEnv ...string) {
t.Fatal(err) t.Fatal(err)
} }
// Set default prefix
if share.App.Prefix == "" {
share.App.Prefix = "yao_"
}
utils.Init() utils.Init()
dbconnect(t, cfg) dbconnect(t, cfg)
load(t, cfg) load(t, cfg)