- Add deployment-name branding to titles, mastheads, and OG tags - Share one grant delivery-state query with lineage across grants surfaces - Show pool status/usage, org owners, and config readiness - Make billing views projection-aware with recency and sync vocabulary - Guard FedWiki creation without domains and render route-aware 404s
52 lines
2.1 KiB
Go
52 lines
2.1 KiB
Go
package server
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// TestMemberAddonsTruthfulCopy pins the member-product-discovery delta
|
|
// (UX-7): an unpurchasable add-on must never claim "Coming soon" — that
|
|
// asserts a roadmap that does not exist. It renders disabled with a plain
|
|
// "Not available yet". A purchasable add-on renders the normal purchase
|
|
// affordance (an enabled Add control wired to checkout) with no
|
|
// unavailability copy at all.
|
|
func TestMemberAddonsTruthfulCopy(t *testing.T) {
|
|
t.Run("unpurchasable add-on shows truthful unavailable copy, not a roadmap claim", func(t *testing.T) {
|
|
data := AddonsData{Addons: []AddonViewModel{
|
|
{ProductID: "p1", Name: "Extra Storage", Description: "More room.", Purchasable: false},
|
|
}}
|
|
out := renderMemberDomains(t, "member_addons.html", data)
|
|
|
|
if strings.Contains(out, "Coming soon") {
|
|
t.Error("unpurchasable add-on must not claim \"Coming soon\" (fictional roadmap claim)")
|
|
}
|
|
if !strings.Contains(out, "Not available yet") {
|
|
t.Error("unpurchasable add-on must state truthfully that it is not available yet")
|
|
}
|
|
if !strings.Contains(out, "disabled") {
|
|
t.Error("unpurchasable add-on's control must render disabled")
|
|
}
|
|
if strings.Contains(out, `hx-post="/billing/checkout"`) {
|
|
t.Error("unpurchasable add-on must not submit to checkout")
|
|
}
|
|
})
|
|
|
|
t.Run("purchasable add-on renders the normal purchase affordance, no unavailability copy", func(t *testing.T) {
|
|
data := AddonsData{Addons: []AddonViewModel{
|
|
{ProductID: "p2", Name: "Extra Storage", Description: "More room.", PriceID: "price-1", Purchasable: true},
|
|
}}
|
|
out := renderMemberDomains(t, "member_addons.html", data)
|
|
|
|
if strings.Contains(out, "Not available yet") || strings.Contains(out, "Coming soon") {
|
|
t.Error("purchasable add-on must not render unavailability copy")
|
|
}
|
|
if strings.Contains(out, "disabled") {
|
|
t.Error("purchasable add-on's control must not render disabled")
|
|
}
|
|
if !strings.Contains(out, `hx-post="/billing/checkout"`) || !strings.Contains(out, `"price_id": "price-1"`) {
|
|
t.Error("purchasable add-on must submit to checkout with its price id")
|
|
}
|
|
})
|
|
}
|