Skip to content

Commit

Permalink
fix error in test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
bmo-at-a9s committed Oct 31, 2023
1 parent 9f4e75e commit bfb15e0
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package goosedbversion

import (
"errors"
"fmt"
"testing"

"gopkg.in/DATA-DOG/go-sqlmock.v1"
Expand Down Expand Up @@ -80,17 +79,14 @@ func TestPgSQLGooseDB(t *testing.T) {
})

Convey("if there is a problem talking to the database", func() {

expectedErrorMessage := fmt.Sprintf("Error trying to get current database version: %s", "error")

// Database setup
mock.ExpectQuery(selectFromDBVersionWhere).
WillReturnError(errors.New("error"))

Convey("there should be an error", func() {
repository, _ := NewPostgresGooseDBVersionRepository(db)
_, err := repository.GetCurrentVersion()
So(err, ShouldResemble, errors.New(expectedErrorMessage))
So(err, ShouldResemble, custom_errors.ErrGettingCurrentVersion(errors.New("error")))

dberr := mock.ExpectationsWereMet()
So(dberr, ShouldBeNil)
Expand Down

0 comments on commit bfb15e0

Please sign in to comment.