diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2024-03-09 16:15:34 -0500 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2024-03-09 16:15:34 -0500 |
| commit | 8c4a085cc27eca9966e6f37393c8053fef0c8a1c (patch) | |
| tree | f7b6a45d341e8f503b4338b4ff580a56eb3af872 /internal/repositories | |
| parent | Use actions/checkout@v4 (diff) | |
| download | cli-8c4a085cc27eca9966e6f37393c8053fef0c8a1c.zip | |
Cleanup tests
Diffstat (limited to 'internal/repositories')
| -rw-r--r-- | internal/repositories/migration_db_repo.go | 2 | ||||
| -rw-r--r-- | internal/repositories/migration_db_repo_test.go | 60 |
2 files changed, 1 insertions, 61 deletions
diff --git a/internal/repositories/migration_db_repo.go b/internal/repositories/migration_db_repo.go index 8373eda..56bff0c 100644 --- a/internal/repositories/migration_db_repo.go +++ b/internal/repositories/migration_db_repo.go @@ -36,7 +36,7 @@ func NewMigrationDBRepo(db storage.DB) (MigrationDBRepo, error) { `) if err != nil { return nil, fmt.Errorf( - "unable to confirm bolt_migrations database table exists: %w", + "unable to create or confirm bolt_migrations database table exists: %w", err, ) } diff --git a/internal/repositories/migration_db_repo_test.go b/internal/repositories/migration_db_repo_test.go index 0ab6348..b9fb16e 100644 --- a/internal/repositories/migration_db_repo_test.go +++ b/internal/repositories/migration_db_repo_test.go @@ -46,19 +46,6 @@ func TestNewMigrationDBRepo_TableAlreadyExists(t *testing.T) { assert.Equal(t, scanResult, 1) } -// func TestNewMigrationDBRepo_TableCreationErr(t *testing.T) { -// expectedErr := errors.New("error!") -// db := bolttest.MockSqlDb{ -// ExecReturnValue: bolttest.ExecReturnValue{ -// Err: expectedErr, -// }, -// } - -// _, err := repositories.NewMigrationDBRepo(&db) - -// assert.ErrorIs(t, err, expectedErr) -// } - func TestList_EmptyTable(t *testing.T) { db := bolttest.NewTestDB(t) repo, err := repositories.NewMigrationDBRepo(db) @@ -69,21 +56,6 @@ func TestList_EmptyTable(t *testing.T) { assert.Equal(t, len(migrations), 0) } -// func TestList_QueryErr(t *testing.T) { -// expectedErr := errors.New("error!") -// db := bolttest.MockSqlDb{ -// QueryReturnValue: bolttest.QueryReturnValue{ -// Err: expectedErr, -// }, -// } -// repo, err := repositories.NewMigrationDBRepo(&db) -// assert.Nil(t, err) - -// _, err = repo.List() - -// assert.ErrorIs(t, err, expectedErr) -// } - func TestList_SingleResult(t *testing.T) { db := bolttest.NewTestDB(t) repo, err := repositories.NewMigrationDBRepo(db) @@ -180,22 +152,6 @@ func TestApply_MalformedSql(t *testing.T) { assert.Equal(t, migration.Applied, false) } -// func TestApplyWithTx_BeginErr(t *testing.T) { -// expectedErr := errors.New("error!") -// db := bolttest.MockSqlDb{ -// BeginReturnValue: bolttest.BeginReturnValue{ -// Err: expectedErr, -// }, -// } -// repo, err := repositories.NewMigrationDBRepo(&db) -// assert.Nil(t, err) -// migration := models.NewTimestampMigration(time.Now(), "test") - -// err = repo.ApplyWithTx("SELECT 1 FROM bolt_migrations;", migration) - -// assert.ErrorIs(t, err, expectedErr) -// } - func TestApplyWithTx_ExecErr(t *testing.T) { db := bolttest.NewTestDB(t) repo, err := repositories.NewMigrationDBRepo(db) @@ -268,22 +224,6 @@ func TestRevert_MalformedSql(t *testing.T) { assert.Equal(t, migration.Applied, true) } -// func TestRevertWithTx_BeginErr(t *testing.T) { -// expectedErr := errors.New("error!") -// db := bolttest.MockSqlDb{ -// BeginReturnValue: bolttest.BeginReturnValue{ -// Err: expectedErr, -// }, -// } -// repo, err := repositories.NewMigrationDBRepo(&db) -// assert.Nil(t, err) -// migration := models.NewTimestampMigration(time.Now(), "test") - -// err = repo.RevertWithTx("DROP TABLE bolt_migrations;", migration) - -// assert.ErrorIs(t, err, expectedErr) -// } - func TestRevertWithTx_ExecErr(t *testing.T) { db := bolttest.NewTestDB(t) repo, err := repositories.NewMigrationDBRepo(db) |