mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-02-23 03:45:47 -05:00
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6794 Reviewed-by: 0ko <0ko@noreply.codeberg.org> Reviewed-by: Beowulf <beowulf@beocode.eu> Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: Shiny Nematoda <snematoda@noreply.codeberg.org> Co-authored-by: Robert Wolff <mahlzahn@posteo.de> Co-committed-by: Robert Wolff <mahlzahn@posteo.de>
26 lines
712 B
Go
26 lines
712 B
Go
package integration
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
|
|
"code.gitea.io/gitea/modules/setting"
|
|
"code.gitea.io/gitea/modules/test"
|
|
"code.gitea.io/gitea/tests"
|
|
|
|
"github.com/PuerkitoBio/goquery"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestExploreCodeSearchIndexer(t *testing.T) {
|
|
defer tests.PrepareTestEnv(t)()
|
|
defer test.MockVariableValue(&setting.Indexer.RepoIndexerEnabled, true)()
|
|
|
|
req := NewRequest(t, "GET", "/explore/code?q=file&fuzzy=true")
|
|
resp := MakeRequest(t, req, http.StatusOK)
|
|
doc := NewHTMLParser(t, resp.Body).Find(".explore")
|
|
|
|
doc.Find(".file-body").Each(func(i int, sel *goquery.Selection) {
|
|
assert.Positive(t, sel.Find(".code-inner").Find(".search-highlight").Length(), 0)
|
|
})
|
|
}
|