Introduce a commercial license option alongside AGPL-3.0-only, require a CLA for contributors, and document the terms in COMMERCIAL.md and NOTICE. Add a script to stamp SPDX headers on Go files and apply it across the tree.
34 lines
1.2 KiB
Go
34 lines
1.2 KiB
Go
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
// SPDX-FileCopyrightText: 2025-2026 Christian Galo
|
|
|
|
package server
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// TestOrgEnrollmentRevokeConfirm_NamesTargetOrFallsBack covers the
|
|
// empty-ProductName confirm body (hardening-polish): a live grant whose
|
|
// product lookup produced no name must fall back to a whole phrase, never
|
|
// render "Revoke for this organization" with a dangling gap.
|
|
func TestOrgEnrollmentRevokeConfirm_NamesTargetOrFallsBack(t *testing.T) {
|
|
data := onePoolFixture()
|
|
data.Grants = []GrantViewModel{
|
|
{GrantID: "g-named", ProductName: "Standard Plan", GrantReason: "purchase", DeliveryState: "live"},
|
|
{GrantID: "g-unnamed", ProductName: "", GrantReason: "purchase", DeliveryState: "live"},
|
|
}
|
|
|
|
body := renderOrgEnrollment(t, data)
|
|
|
|
if !strings.Contains(body, "Revoke Standard Plan for this organization?") {
|
|
t.Errorf("named grant should interpolate the product name into the confirm body")
|
|
}
|
|
if !strings.Contains(body, "Revoke this grant for this organization?") {
|
|
t.Errorf("unnamed grant should fall back to the generic confirm phrase")
|
|
}
|
|
if strings.Contains(body, "Revoke for this organization") {
|
|
t.Errorf("confirm body rendered the dangling empty-name phrase")
|
|
}
|
|
}
|