Add more tests and docs for issue indexer, add db indexer type for searching from database (#6144)
* add more tests and docs for issue indexer, add db indexer type for searching from database * fix typo * fix typo * fix lint * improve docs
This commit is contained in:
@ -295,3 +295,28 @@ func TestIssue_loadTotalTimes(t *testing.T) {
|
||||
assert.NoError(t, ms.loadTotalTimes(x))
|
||||
assert.Equal(t, int64(3662), ms.TotalTrackedTime)
|
||||
}
|
||||
|
||||
func TestIssue_SearchIssueIDsByKeyword(t *testing.T) {
|
||||
assert.NoError(t, PrepareTestDatabase())
|
||||
|
||||
total, ids, err := SearchIssueIDsByKeyword("issue2", 1, 10, 0)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, 1, total)
|
||||
assert.EqualValues(t, []int64{2}, ids)
|
||||
|
||||
total, ids, err = SearchIssueIDsByKeyword("first", 1, 10, 0)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, 1, total)
|
||||
assert.EqualValues(t, []int64{1}, ids)
|
||||
|
||||
total, ids, err = SearchIssueIDsByKeyword("for", 1, 10, 0)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, 4, total)
|
||||
assert.EqualValues(t, []int64{1, 2, 3, 5}, ids)
|
||||
|
||||
// issue1's comment id 2
|
||||
total, ids, err = SearchIssueIDsByKeyword("good", 1, 10, 0)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, 1, total)
|
||||
assert.EqualValues(t, []int64{1}, ids)
|
||||
}
|
||||
|
Reference in New Issue
Block a user