mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-10-31 06:21:11 +00:00 
			
		
		
		
	closes #4534 <details> <summary>Screenshots</summary>  </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)
 | |
| 	})
 | |
| }
 |