diff --git a/driver.go b/driver.go index 01d7451..346f36f 100644 --- a/driver.go +++ b/driver.go @@ -45,7 +45,7 @@ func (p *pgxmockPool) Acquire(context.Context) (*pgxpool.Conn, error) { } func (p *pgxmockPool) Config() *pgxpool.Config { - return &pgxpool.Config{} + return &pgxpool.Config{ConnConfig: &pgx.ConnConfig{}} } // AsConn is similar to Acquire but returns proper mocking interface diff --git a/driver_test.go b/driver_test.go index 9c0eb42..7053a2d 100644 --- a/driver_test.go +++ b/driver_test.go @@ -62,3 +62,28 @@ func TestPoolStat(t *testing.T) { t.Error("expected stat object, but got nil") } } + +func TestPoolConfig(t *testing.T) { + mock, err := NewPool() + if err != nil { + t.Fatalf("expected no error, but got: %s", err) + } + c := mock.Config() + if c == nil { + t.Fatal("expected config object, but got nil") + } + if c.ConnConfig == nil { + t.Fatal("expected conn config object, but got nil") + } +} + +func TestConnConfig(t *testing.T) { + mock, err := NewConn() + if err != nil { + t.Fatalf("expected no error, but got: %s", err) + } + c := mock.Config() + if c == nil { + t.Fatal("expected config object, but got nil") + } +}