Replace the entity slugs on organizations, workspaces, resource pools, and plan ladders with nullable `key` columns and add keys to products, prices, and entitlement sets. Rename `providers.slug` to `provider` and add partial unique indexes for system and org role names. Assign invoice numbers per billing account from a gapless transactional counter; Stripe's number moves to the invoice mapping as an external reference. Seeds, fixtures, and the operator lookup address rows by key, and the returning-login resync no longer blanks a display name when the IdP sends no `name` claim.
19 lines
490 B
Go
19 lines
490 B
Go
package provisioning
|
|
|
|
import "testing"
|
|
|
|
func TestDisplayNameFromClaims(t *testing.T) {
|
|
cases := []struct{ name, preferred, want string }{
|
|
{"Alice Admin", "alice", "Alice Admin"},
|
|
{"", "alice", "alice"},
|
|
{" ", "alice", "alice"},
|
|
{"", "", ""},
|
|
{" Bob ", "", "Bob"},
|
|
}
|
|
for _, tc := range cases {
|
|
if got := DisplayNameFromClaims(tc.name, tc.preferred); got != tc.want {
|
|
t.Errorf("DisplayNameFromClaims(%q, %q) = %q, want %q", tc.name, tc.preferred, got, tc.want)
|
|
}
|
|
}
|
|
}
|