aboutsummaryrefslogtreecommitdiffstats
path: root/internal/storage/db_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/storage/db_test.go')
-rw-r--r--internal/storage/db_test.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/internal/storage/db_test.go b/internal/storage/db_test.go
index 61a9bf4..c871c47 100644
--- a/internal/storage/db_test.go
+++ b/internal/storage/db_test.go
@@ -10,7 +10,7 @@ import (
"github.com/eugenetriguba/checkmate/assert"
)
-func TestDBConnectWithPostgres(t *testing.T) {
+func TestDBConnect_Success(t *testing.T) {
cfg := bolttest.NewTestConnectionConfig(t, "postgres")
conn, err := storage.DBConnect(cfg.Driver, storage.DBConnectionString(cfg))
@@ -21,15 +21,17 @@ func TestDBConnectWithPostgres(t *testing.T) {
assert.Nil(t, err)
}
-func TestDBConnectMalformedConnectionString(t *testing.T) {
+func TestDBConnect_BadConnectionString(t *testing.T) {
_, err := storage.DBConnect("postgres", "pizza=123")
+ assert.ErrorIs(t, err, storage.ErrUnableToConnect)
assert.ErrorContains(t, err, "connection refused")
}
-func TestDBConnectUnsupportedDriver(t *testing.T) {
+func TestDBConnect_UnsupportedDriver(t *testing.T) {
cfg := bolttest.NewTestConnectionConfig(t, "redis")
_, err := storage.DBConnect(cfg.Driver, storage.DBConnectionString(cfg))
+ assert.ErrorIs(t, err, storage.ErrInvalidConnectionString)
assert.ErrorContains(t, err, `unknown driver "redis"`)
}