- Brand receipt status strings (statuslang) for notify/queue - Windows tray + Start Menu/Startup install; macOS menubar helper - CERT-01 plum/gold PDF + multihash/blake3 when present - printit.verae.ai brand kit, queue page, customer-auth helper - verae-print pending/tray-status/menubar commands
99 lines
3.2 KiB
Go
99 lines
3.2 KiB
Go
package statuslang
|
||
|
||
import (
|
||
"strings"
|
||
"testing"
|
||
)
|
||
|
||
func TestLabels(t *testing.T) {
|
||
// Exact BrandingBook chip strings (brand-tokens status.*).
|
||
want := map[string]string{
|
||
"queued": "Queued offline",
|
||
"hashing": "Hashing on device…",
|
||
"existing": "Already registered",
|
||
"pending": "Pending receipt",
|
||
"provisional": "Stamped, awaiting blockchain",
|
||
"failed": "Failed – retrying",
|
||
"action": "Failed – action needed",
|
||
}
|
||
for state, label := range want {
|
||
if Label(state) != label {
|
||
t.Fatalf("%s: got %q want %q", state, Label(state), label)
|
||
}
|
||
}
|
||
if Pending != "Pending receipt" {
|
||
t.Fatal(Pending)
|
||
}
|
||
if Finalized(1284600) != "Final: Substrate block #1,284,600, finalized" {
|
||
t.Fatal(Finalized(1284600))
|
||
}
|
||
if Included(99) != "Included in block #99 (not final)" {
|
||
t.Fatal(Included(99))
|
||
}
|
||
if Label("included", 1284515) != "Included in block #1,284,515 (not final)" {
|
||
t.Fatal(Label("included", 1284515))
|
||
}
|
||
if Label("final", 1284512) != "Final: Substrate block #1,284,512, finalized" {
|
||
t.Fatal(Label("final", 1284512))
|
||
}
|
||
if Label("included") != IncludedN() || Label("final") != FinalizedN() {
|
||
t.Fatalf("unknown block placeholders: %q %q", Label("included"), Label("final"))
|
||
}
|
||
if NotifyTitle("final") != FinalReceiptReady {
|
||
t.Fatal(NotifyTitle("final"))
|
||
}
|
||
if NotifyTitle("held") != SignInToFinish {
|
||
t.Fatal(NotifyTitle("held"))
|
||
}
|
||
b := NotifyBody("held", "Board pack.pdf", "20261013-120000-ab")
|
||
if b == "" || b == "Board pack.pdf" {
|
||
t.Fatal(b)
|
||
}
|
||
if !strings.Contains(b, Pending) || !strings.Contains(b, "hold ") {
|
||
t.Fatalf("held body should mark local hold, got %q", b)
|
||
}
|
||
if strings.Contains(b, "held as") {
|
||
t.Fatalf("must not imply hold id is a receipt: %q", b)
|
||
}
|
||
f := NotifyBody("final", "Board pack.pdf", "bafkreiabc123xyz")
|
||
if !strings.Contains(f, "receipt ") {
|
||
t.Fatalf("final body should name receipt: %q", f)
|
||
}
|
||
ht, hb := NotifyHeldJobs(3)
|
||
if ht != NotifyTitle("held") || !strings.Contains(hb, "3 job") || !strings.Contains(hb, Pending) {
|
||
t.Fatalf("held jobs notify: %q %q", ht, hb)
|
||
}
|
||
if TrayHeadline(2, true, true) != NotifyTitle("held") {
|
||
t.Fatalf("held headline: %q", TrayHeadline(2, true, true))
|
||
}
|
||
if TrayHeadline(0, true, true) != PrinterReady {
|
||
t.Fatalf("ready headline: %q", TrayHeadline(0, true, true))
|
||
}
|
||
d := TrayDetail(1, false, true)
|
||
if !strings.Contains(d, Pending) || !strings.Contains(d, "1 held") || !strings.Contains(d, "no signing key") {
|
||
t.Fatalf("tray detail: %q", d)
|
||
}
|
||
if !strings.Contains(EvidenceNote, "final receipt") {
|
||
t.Fatal(EvidenceNote)
|
||
}
|
||
}
|
||
|
||
func TestIsEvidenceAndDesc(t *testing.T) {
|
||
if !IsEvidence("final") || !IsEvidence("existing") || !IsEvidence("ok") {
|
||
t.Fatal("final/existing must be evidence")
|
||
}
|
||
for _, s := range []string{"pending", "provisional", "included", "queued", "hashing", "failed", "action", "held"} {
|
||
if IsEvidence(s) {
|
||
t.Fatalf("%s must not be evidence", s)
|
||
}
|
||
}
|
||
if Desc("pending") != DescPending || Desc("final") != DescFinal {
|
||
t.Fatalf("desc: %q %q", Desc("pending"), Desc("final"))
|
||
}
|
||
if ChainName != "Verae Substrate blockchain" || NetworkName != "VeraeNet" {
|
||
t.Fatalf("chain vocab: %q %q", ChainName, NetworkName)
|
||
}
|
||
if VerifyBase != "https://verify.verae.ai" {
|
||
t.Fatal(VerifyBase)
|
||
}
|
||
}
|