mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-01 15:19:09 +01:00
06d2e90fa4
closes #4534 <details> <summary>Screenshots</summary> ![](https://codeberg.org/attachments/0ab8a7b0-6485-46dc-a730-c016abb1f287) </details> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4749 Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com> Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
31 lines
833 B
Go
31 lines
833 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")
|
|
|
|
msg := doc.
|
|
Find(".ui.container").
|
|
Find(".ui.message[data-test-tag=grep]")
|
|
assert.EqualValues(t, 0, msg.Length())
|
|
|
|
doc.Find(".file-body").Each(func(i int, sel *goquery.Selection) {
|
|
assert.Positive(t, sel.Find(".code-inner").Find(".search-highlight").Length(), 0)
|
|
})
|
|
}
|