Skip to content

Commit

Permalink
adapted updatenote testcase to new gorm version
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Apr 8, 2024
1 parent 609a765 commit 6ec8338
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/backend/update_note_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ func (s *UpdateNoteSuite) SetupSuite() {
s.deviceBuf = newDeviceBuffer()
}

const ExpectedGetUpdateNoteQuery = "SELECT * FROM `update_note` WHERE `update_note`.`version_code` = ? ORDER BY `update_note`.`version_code` LIMIT 1"
const ExpectedGetUpdateNoteQuery = "SELECT * FROM `update_note` WHERE `update_note`.`version_code` = ? ORDER BY `update_note`.`version_code` LIMIT ?"

func (s *UpdateNoteSuite) Test_GetUpdateNoteOne() {
s.mock.ExpectQuery(regexp.QuoteMeta(ExpectedGetUpdateNoteQuery)).
WithArgs(1).
WithArgs(1, 1).
WillReturnRows(sqlmock.NewRows([]string{"version_code", "version_name", "message"}).
AddRow(1, "1.0.0", "Test Message"))

Expand All @@ -67,7 +67,7 @@ func (s *UpdateNoteSuite) Test_GetUpdateNoteOne() {

func (s *UpdateNoteSuite) Test_GetUpdateNoteNone() {
s.mock.ExpectQuery(regexp.QuoteMeta(ExpectedGetUpdateNoteQuery)).
WithArgs(1).
WithArgs(1, 1).
WillReturnRows(sqlmock.NewRows([]string{"version_code", "version_name", "message"}))

meta := metadata.MD{}
Expand All @@ -79,7 +79,7 @@ func (s *UpdateNoteSuite) Test_GetUpdateNoteNone() {

func (s *UpdateNoteSuite) Test_GetUpdateNoteError() {
s.mock.ExpectQuery(regexp.QuoteMeta(ExpectedGetUpdateNoteQuery)).
WithArgs(1).
WithArgs(1, 1).
WillReturnError(gorm.ErrInvalidDB)

meta := metadata.MD{}
Expand Down

0 comments on commit 6ec8338

Please sign in to comment.