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.
52 lines
1.7 KiB
Go
52 lines
1.7 KiB
Go
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
// SPDX-FileCopyrightText: 2025-2026 Christian Galo
|
|
|
|
package server
|
|
|
|
import "testing"
|
|
|
|
// TestPageTitleNamesThePage covers the operator shell's document title: it
|
|
// is the body's own page-header title, the landing header on the landing
|
|
// page, and the capability label when a body carries no header (maintainer,
|
|
// 2026-09-03: every operator tab read "Operator overview").
|
|
func TestPageTitleNamesThePage(t *testing.T) {
|
|
cases := []struct {
|
|
name string
|
|
page OperatorPageData
|
|
want string
|
|
}{
|
|
{
|
|
name: "landing uses the shell's landing header",
|
|
page: OperatorPageData{},
|
|
want: "Operator overview",
|
|
},
|
|
{
|
|
name: "a body with a Header method",
|
|
page: OperatorPageData{BodyTemplate: "operator_org_types.html", ActiveCapability: "organizations", BodyData: OrgTypesData{}},
|
|
want: OrgTypesData{}.Header().Title,
|
|
},
|
|
{
|
|
name: "a body with a Header method behind a pointer",
|
|
page: OperatorPageData{BodyTemplate: "operator_org_types.html", ActiveCapability: "organizations", BodyData: &OrgTypesData{}},
|
|
want: OrgTypesData{}.Header().Title,
|
|
},
|
|
{
|
|
name: "a body without a header falls back to the capability label",
|
|
page: OperatorPageData{BodyTemplate: "operator_thing.html", ActiveCapability: "entitlement-sets", BodyData: struct{ X int }{}},
|
|
want: "Entitlement sets",
|
|
},
|
|
{
|
|
name: "a nil body outside the landing falls back to the capability label",
|
|
page: OperatorPageData{BodyTemplate: "operator_thing.html", ActiveCapability: "billing"},
|
|
want: "Billing",
|
|
},
|
|
}
|
|
for _, tc := range cases {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
if got := pageTitle(tc.page); got != tc.want {
|
|
t.Errorf("pageTitle = %q, want %q", got, tc.want)
|
|
}
|
|
})
|
|
}
|
|
}
|