21 lines
504 B
Go
21 lines
504 B
Go
package database
|
|
|
|
import (
|
|
"context"
|
|
"github.com/stretchr/testify/assert"
|
|
"testing"
|
|
)
|
|
|
|
func TestConnectionPool(t *testing.T) {
|
|
// Test với connection pool mock
|
|
t.Run("Get connection pool", func(t *testing.T) {
|
|
pool := GetConnectionPool()
|
|
assert.Nil(t, pool) // Pool chưa được khởi tạo
|
|
})
|
|
|
|
t.Run("Initialize pool", func(t *testing.T) {
|
|
err := InitPool(context.Background(), "invalid_connection_string")
|
|
assert.Error(t, err, "Expected error with invalid connection string")
|
|
})
|
|
}
|