package web
import (
"strings"
"testing"
)
// Any signed-in account may start a repository (repo.add), so the
// header's create menu offers it to anyone signed in, not only a site
// admin: lou had to go back to the home page to find it (#387).
func TestTheCreateMenuOffersANewRepositoryToAnyoneSignedIn(t *testing.T) {
body := renderBase(t, pageData{Title: "Home", SignedIn: "lou"})
if !strings.Contains(body, `href="/new" data-hook="create-repo"`) {
t.Error("FAIL: a signed-in account without admin has no new-repository entry in the create menu")
}
if strings.Contains(renderBase(t, pageData{Title: "Home"}), `data-hook="create-repo"`) {
t.Error("FAIL: a visitor who is not signed in is offered a new repository")
}
}