Closed thelebdev closed 4 years ago
In the test you check if all expectations are matched, before calling getPosts
Can you please further explain or refer me to a part of the documentation where I missed what you just said?
Look at the tests in the sqlmock library
@christopheelkhoury reverse the call to your function and the expectations
getPosts() // to call the function itself
if err := mock.ExpectationsWereMet(); err != nil {
t.Errorf("There were unfulfilled expectations: %s", err)
}
I've got the following function to query a Database Table:
Printing the results above yields the desired output. Moving on to my Unit Test,
The problem is, I always get the following output
I've followed the examples to the best of my knowledge.