package web

import (
	"strings"
	"testing"
)

// Scenario C (v0.60.1) — the host-delete escrow checkbox must tell the truth: host deletion DEMOTES
// the blob to retained custody, it does not destroy it. Guards the wording against a regression.
func TestHostDeleteEscrowLabel_DemotionWording(t *testing.T) {
	b, err := templateFS.ReadFile("templates/host_detail_body.html")
	if err != nil {
		t.Fatal(err)
	}
	src := string(b)
	if !strings.Contains(src, "Move key escrow to retained custody") {
		t.Error("host-delete escrow checkbox must use demotion wording (retained custody)")
	}
	if strings.Contains(src, "Also delete the key escrow") {
		t.Error("host-delete escrow checkbox still uses destruction wording (regression)")
	}
	// The customer Danger-zone copy names the permanent purge of retained custody (the one true point).
	cb, err := templateFS.ReadFile("templates/customer_unified.html")
	if err != nil {
		t.Fatal(err)
	}
	if !strings.Contains(string(cb), "retained recovery-key custody") {
		t.Error("customer Danger-zone copy must name the permanent removal of retained recovery-key custody")
	}
}
