[feature] migrate to monorepo
This commit is contained in:
commit
05ddc1f783
267 changed files with 75165 additions and 0 deletions
40
backend/internal/server/ent_test.go
Normal file
40
backend/internal/server/ent_test.go
Normal file
|
@ -0,0 +1,40 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"tss-rocks-be/internal/config"
|
||||
)
|
||||
|
||||
func TestNewEntClient(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
cfg *config.Config
|
||||
}{
|
||||
{
|
||||
name: "default sqlite3 config",
|
||||
cfg: &config.Config{
|
||||
Database: config.DatabaseConfig{
|
||||
Driver: "sqlite3",
|
||||
DSN: "file:ent?mode=memory&cache=shared&_fk=1",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
client := NewEntClient(tt.cfg)
|
||||
assert.NotNil(t, client)
|
||||
|
||||
// 验证客户端是否可以正常工作
|
||||
err := client.Schema.Create(context.Background())
|
||||
assert.NoError(t, err)
|
||||
|
||||
// 清理
|
||||
client.Close()
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue