Skip to content
quarry Artifact [bf0096b507]
Login

Artifact [bf0096b507]

Artifact bf0096b5070275c245530bd10960bb01411c88fdf7ac0402a9bd5a7bbb1339fc:


package web

import (
	"strings"
	"testing"
)

// A tracking mirror that holds check-ins its upstream lacks says so on
// the fleet summary, with the time as data, so the operator can decide
// to detach it; a mirror never pushed onto carries nothing (5d40f151).
func TestTheFleetRowFlagsADivergedMirror(t *testing.T) {
	var sb strings.Builder
	rows := []mirrorRow{
		{Repo: "fossil", Enabled: true, State: "current"},
		{Repo: "wapp", Enabled: true, State: "current", DivergedAt: "2026-09-23T03:00:00Z"},
	}
	err := noHooks.template(fleetAdminPage).ExecuteTemplate(&sb, "fleet-mirrors", pageData{
		Mirrors:      rows,
		MirrorCounts: map[string]int{"all": 2, "current": 2},
	})
	if err != nil {
		t.Fatal(err)
	}
	body := sb.String()
	if strings.Count(body, `data-hook="mirror-diverged"`) != 1 || !strings.Contains(body, `data-hook="mirror-diverged" data-at="2026-09-23T03:00:00Z"`) {
		t.Fatal("FAIL: exactly one mirror should carry the diverged chip with its time")
	}
	t.Log("ok: wapp flagged as pushed onto locally, fossil clean")
}