PrintToVeraeTimeStamp/internal/pdfcert/pdfcert_test.go
George Lambert 38b902d5e7 fix(pdfcert): branded Registration Document without mcp.verae.ai
Match the official Verae Timestamp Registration Document layout (logo,
frames, field list, QR). Disclaimer: only the digest was submitted.
Lookup/footer use explorer.verae.ai — no mcp.verae.ai or “via MCP”.
2026-10-03 04:15:28 -04:00

54 lines
1.2 KiB
Go

package pdfcert
import (
"bytes"
"strings"
"testing"
)
func TestBuildBrandedRegistration(t *testing.T) {
b, err := Build(Input{
DocumentName: "Contract.pdf",
SHA256: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
ReceiptID: "QmTestReceipt123",
CreatedAt: "2026-10-03T12:00:00Z",
Merkle: "113198",
Scope: "global",
ByteLength: 4096,
})
if err != nil {
t.Fatal(err)
}
if !bytes.HasPrefix(b, []byte("%PDF")) {
t.Fatal("not a pdf")
}
if len(b) < 5000 {
t.Fatalf("pdf too small (%d) — logo/qr missing?", len(b))
}
s := string(b)
if strings.Contains(s, "mcp.verae.ai") {
t.Fatal("must not mention mcp.verae.ai")
}
if strings.Contains(s, "via MCP") {
t.Fatal("must not say via MCP")
}
if !strings.Contains(s, "Verae Timestamp Registration Document") {
t.Fatal("missing title")
}
if !strings.Contains(s, "only the digest was submitted") {
t.Fatal("missing digests-only disclaimer")
}
if !strings.Contains(s, "explorer.verae.ai") {
t.Fatal("expected explorer lookup")
}
}
func TestLookupURLNoMCP(t *testing.T) {
u := LookupURL("abc", "rid")
if strings.Contains(u, "mcp.verae.ai") {
t.Fatal(u)
}
if !strings.Contains(u, "explorer.verae.ai") {
t.Fatal(u)
}
}