Test: WebDAV model

This commit is contained in:
HFO4
2020-02-21 11:32:59 +08:00
parent 5363b90167
commit 9b3f5b0efd
5 changed files with 87 additions and 2 deletions

View File

@@ -79,3 +79,15 @@ func TestGetTasksByID(t *testing.T) {
asserts.NoError(err)
asserts.EqualValues(1, res.ID)
}
func TestListTasks(t *testing.T) {
asserts := assert.New(t)
mock.ExpectQuery("SELECT(.+)").WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(5))
mock.ExpectQuery("SELECT(.+)").WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(5))
res, total := ListTasks(1, 1, 10, "")
asserts.NoError(mock.ExpectationsWereMet())
asserts.EqualValues(5, total)
asserts.Len(res, 1)
}