()
| 264 | } |
| 265 | |
| 266 | func (s *UserTestSuite) TestUpdateUserDBSaveErr() { |
| 267 | s.Fixtures.SQLMock.ExpectBegin() |
| 268 | s.Fixtures.SQLMock. |
| 269 | ExpectQuery(regexp.QuoteMeta("SELECT * FROM `users` WHERE username = ? AND `users`.`deleted_at` IS NULL ORDER BY `users`.`id` LIMIT ?")). |
| 270 | WithArgs(s.Fixtures.Users[0].ID, 1). |
| 271 | WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(s.Fixtures.Users[0].ID)) |
| 272 | s.Fixtures.SQLMock. |
| 273 | ExpectExec(("UPDATE `users` SET")). |
| 274 | WillReturnError(fmt.Errorf("saving user mock error")) |
| 275 | s.Fixtures.SQLMock.ExpectRollback() |
| 276 | |
| 277 | _, err := s.StoreSQLMocked.UpdateUser(context.Background(), s.Fixtures.Users[0].ID, s.Fixtures.UpdateUserParams) |
| 278 | |
| 279 | s.assertSQLMockExpectations() |
| 280 | s.Require().NotNil(err) |
| 281 | s.Require().Equal("error updating user: error saving user: saving user mock error", err.Error()) |
| 282 | } |
| 283 | |
| 284 | func TestUserTestSuite(t *testing.T) { |
| 285 | suite.Run(t, new(UserTestSuite)) |
nothing calls this directly
no test coverage detected