1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-01 17:38:33 +00:00

feat: wiki search using git-grep

+ add release note
This commit is contained in:
Shiny Nematoda 2024-05-20 12:23:27 +00:00
parent d6915f4d5f
commit ec4f5495ba
10 changed files with 107 additions and 0 deletions

View file

@ -15,9 +15,26 @@ import (
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/tests"
"github.com/PuerkitoBio/goquery"
"github.com/stretchr/testify/assert"
)
func TestWikiSearchContent(t *testing.T) {
defer tests.PrepareTestEnv(t)()
req := NewRequest(t, "GET", "/user2/repo1/wiki/search?q=This")
resp := MakeRequest(t, req, http.StatusOK)
doc := NewHTMLParser(t, resp.Body)
res := doc.Find(".item > b").Map(func(_ int, el *goquery.Selection) string {
return el.Text()
})
assert.Equal(t, []string{
"Home.md",
"Page-With-Spaced-Name.md",
"Unescaped File.md",
}, res)
}
func TestWikiBranchNormalize(t *testing.T) {
defer tests.PrepareTestEnv(t)()