Test: newly added sb models

This commit is contained in:
HFO4
2021-11-09 19:29:56 +08:00
parent 3064ed60f3
commit eeee43d569
5 changed files with 31 additions and 5 deletions

View File

@@ -91,3 +91,14 @@ func TestListTasks(t *testing.T) {
asserts.EqualValues(5, total)
asserts.Len(res, 1)
}
func TestGetTasksByStatus(t *testing.T) {
a := assert.New(t)
mock.ExpectQuery("SELECT(.+)").
WithArgs(1, 2).
WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(1))
res := GetTasksByStatus(1, 2)
a.NoError(mock.ExpectationsWereMet())
a.Len(res, 1)
}