Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Add DB test for GetSyncData
Browse files Browse the repository at this point in the history
  • Loading branch information
jbygdell committed Nov 30, 2022
1 parent b1075b7 commit f9f6f3c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions internal/database/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,3 +533,17 @@ func TestClose(t *testing.T) {

assert.Nil(t, r, "Close failed unexpectedly")
}

func TestGetSyncData(t *testing.T) {
r := sqlTesterHelper(t, func(mock sqlmock.Sqlmock, testDb *SQLdb) error {
mock.ExpectQuery("SELECT elixir_id, inbox_path, decrypted_file_checksum from local_ega.files WHERE stable_id = \\$1 AND status = 'READY'").
WithArgs("accessionId").WillReturnRows(sqlmock.NewRows([]string{"elixir_id", "inbox_path", "decrypted_file_checksum"}).AddRow("dummy", "/file/paht", "abc123"))

s, err := testDb.GetSyncData("accessionId")
assert.Equal(t, "dummy", s.User)

return err
})

assert.Nil(t, r, "GetSyncData failed unexpectedly")
}

0 comments on commit f9f6f3c

Please sign in to comment.