Add unit test for searching

This commit is contained in:
2025-09-10 16:56:50 +08:00
parent 0a88a65846
commit ff1f6e7340
3 changed files with 174 additions and 3 deletions

View File

@@ -70,3 +70,11 @@ func GetDB() *gorm.DB {
func IsReady() bool {
return ready
}
func Close() error {
sqlDB, err := db.DB()
if err != nil {
return err
}
return sqlDB.Close()
}

View File

@@ -104,8 +104,6 @@ func TestTag(t *testing.T) {
assert.Nil(t, tag6.AliasOf)
// cleanup
d, err := db.DB()
assert.Nil(t, err)
_ = d.Close()
_ = Close()
_ = os.Remove("test.db")
}