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)
		}
	}
}
