githaven-fork/modules/indexer/issues
Nanguan Lin 7cdbe65a2c
Add tests for db indexer in indexer_test.go (#27087)
As described in the title.
Some points: 
1. Why need those tests?
Because `buildIssueOverview` is not well tested, there are several
continuous bugs in the issue overview webpage.
2. Why in indexer_test.go?
It's hard to put those tests in `./modules/indexer/issue/db/db_test.go`
because those tests need 'real' data in db mocked by fixtures instead of
random data in `./modules/indexer/issue/internal/tests`. When using
'real' data(`unittest.PrepareTestDatabase`), `InitIssueIndexer` and the
package `init()` function of `indexer` are required to init indexer.
3. Why only db?
The other three indexer engines are well tested by random data and it's
okay to also test them with 'real' data in db mocked by fixtures. Any
follow-up PR is welcome.
4. Those tests are really basic, any more complicated tests are welcome.
5. I think it's also necessary to add tests in `TestAPISearchIssues`
in`api_test_issue.go` and `TestIssues` in `home_test.go`
2023-09-16 11:15:21 +08:00
..
bleve Refactor and enhance issue indexer to support both searching, filtering and paging (#26012) 2023-07-31 06:28:53 +00:00
db Explain SearchOptions and fix ToSearchOptions (#26542) 2023-08-16 15:40:13 +00:00
elasticsearch Refactor and enhance issue indexer to support both searching, filtering and paging (#26012) 2023-07-31 06:28:53 +00:00
internal Replace util.SliceXxx with slices.Xxx (#26958) 2023-09-07 09:37:47 +00:00
meilisearch Refactor and enhance issue indexer to support both searching, filtering and paging (#26012) 2023-07-31 06:28:53 +00:00
dboptions.go Explain SearchOptions and fix ToSearchOptions (#26542) 2023-08-16 15:40:13 +00:00
indexer_test.go Add tests for db indexer in indexer_test.go (#27087) 2023-09-16 11:15:21 +08:00
indexer.go Fix counting and filtering on the dashboard page for issues (#26657) 2023-08-23 02:29:17 +00:00
util.go Refactor and enhance issue indexer to support both searching, filtering and paging (#26012) 2023-07-31 06:28:53 +00:00