internal/httpd/searchweb_test.go
28 lines · 782 bytes
1package httpd
2
3import (
4 "strings"
5 "testing"
6
7 "gitbay.org/gitbay/internal/web"
8)
9
10// The scope sentence is a permanent caption, not a first-visit-only
11// hint: a visitor who has already searched still needs to know what a
12// search here does and does not cover (#270).
13func TestGlobalSearchScopeCaptionAlwaysShown(t *testing.T) {
14 var sb strings.Builder
15 if err := web.Render(&sb, "globalsearch.html", struct {
16 basePage
17 Tab string
18 Query string
19 Kind string
20 QueryErr string
21 Results []searchResult
22 }{basePage{Site: "gitbay"}, "sitesearch", "gitbay", "", "", nil}); err != nil {
23 t.Fatalf("render: %v", err)
24 }
25 if !strings.Contains(sb.String(), "File contents are searched per repository") {
26 t.Error("scope caption missing once a query is present")
27 }
28}