However, the tests are failing. I am gettingsql: database is closed error when no errors are expected ( that is, after this line : _, err = s.Conn.Exec(query, args...) ). The function works fine when I tested it as a part of the actual code. The issue is just with the unit testing. How to solve this?
I have the following function that takes a slice of type
SchoolDbEntry
and bulk inserts it into a DB.I am trying to test this using sqlmock using the following functions
However, the tests are failing. I am getting
sql: database is closed
error when no errors are expected ( that is, after this line :_, err = s.Conn.Exec(query, args...)
). The function works fine when I tested it as a part of the actual code. The issue is just with the unit testing. How to solve this?