Skip to content
quarry Artifact [b40a95ea3b]
Login

Artifact [b40a95ea3b]

Artifact b40a95ea3bd8514c26d0777fcd4afe41d724d42195052e0917d58d5ba7712d0f:


package web

import (
	"strings"
	"testing"
)

// A page with no inbound link is a page that does not exist.
// /fleet/ops shipped reachable only by typing the URL — the second
// surface to do so, after the notes feed — so the door gets a test
// rather than a promise to remember.
//
// Checked against the template source rather than a rendered page:
// /fleet needs an admin session and a live fleet to render, and the
// question here is simply whether the link is written at all.
func TestFleetLinksToOperations(t *testing.T) {
	// fleetAdminSource, not fleetSource: the summary strip that carries
	// the fleet's counts and the error badge lives in the admin half,
	// which is where an operator reading health already is.
	if !strings.Contains(fleetAdminSource, `href="/fleet/ops"`) {
		t.Error("/fleet carries no link to /fleet/ops; the operations page " +
			"is unreachable without typing the URL")
	}
}

// ...and the way back, so an admin is never stranded on either.
func TestOperationsLinksBackToFleet(t *testing.T) {
	if !strings.Contains(opsPageSource, `href="/fleet"`) {
		t.Error("/fleet/ops carries no link back to /fleet")
	}
}