m's ask 2026-05-20 09:42. Eighth HLC office alongside Munich, Düsseldorf, Hamburg, Amsterdam, London, Paris, Milan. - `internal/offices/offices.go` — append Madrid to All[] (display order: end of list, after Milan). Doc comment refreshed to point at the actual current CHECK constraints (users mig 002 + partner_units mig 018/024/027), not the obsolete akten reference from before projects-v2. - `internal/offices/offices_test.go` — add `madrid` to the valid-keys table. - mig 106 — extend the two CHECK constraints on users.office and partner_units.office. Idempotent (DROP IF EXISTS), audit_reason set_config at top, dry-run validated against the live youpc paliad schema (BEGIN; ALTER...; ROLLBACK). Frontend picks up Madrid automatically via GET /api/offices. Admin UI for managing firm office list is a separate longer-term issue — m's "for now, just add Madrid already" path.
37 lines
907 B
Go
37 lines
907 B
Go
package offices
|
|
|
|
import "testing"
|
|
|
|
func TestIsValid(t *testing.T) {
|
|
for _, key := range []string{"munich", "duesseldorf", "hamburg", "amsterdam", "london", "paris", "milan", "madrid"} {
|
|
if !IsValid(key) {
|
|
t.Errorf("IsValid(%q) = false, want true", key)
|
|
}
|
|
}
|
|
for _, key := range []string{"", "atlantis", "Munich", "muenchen", "dusseldorf"} {
|
|
if IsValid(key) {
|
|
t.Errorf("IsValid(%q) = true, want false", key)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestKeysMatchesAll(t *testing.T) {
|
|
keys := Keys()
|
|
if len(keys) != len(All) {
|
|
t.Fatalf("Keys() len = %d, All len = %d", len(keys), len(All))
|
|
}
|
|
for i, o := range All {
|
|
if keys[i] != o.Key {
|
|
t.Errorf("Keys()[%d] = %q, want %q", i, keys[i], o.Key)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestLabelsArePopulated(t *testing.T) {
|
|
for _, o := range All {
|
|
if o.LabelDE == "" || o.LabelEN == "" {
|
|
t.Errorf("office %q has empty label(s): de=%q en=%q", o.Key, o.LabelDE, o.LabelEN)
|
|
}
|
|
}
|
|
}
|