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

Merge pull request '[FEAT] Wiki Search' (#3847) from snematoda/wiki-search-grep into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3847
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
Earl Warren 2024-05-21 06:27:30 +00:00
commit fb1338537b
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)()