// Copyright (c) 2026 Storm Dragon // SPDX-License-Identifier: GPL-3.0-or-later package emoji import ( "strings" "testing" ) func TestCatalogUniqueAndComplete(t *testing.T) { categories := Categories() if len(categories) != 9 { t.Fatalf("category count = %d, want 9", len(categories)) } seen := make(map[string]bool) strip := strings.NewReplacer("\ufe0e", "", "\ufe0f", "") for _, category := range categories { if category.ID == "" || category.Label == "" || len(category.Entries) == 0 { t.Fatalf("invalid category %#v", category) } for _, entry := range category.Entries { if entry.ID == "" || entry.Label == "" { t.Fatalf("invalid entry %#v", entry) } id := strip.Replace(entry.ID) if seen[id] { t.Fatalf("duplicate presentation %q", entry.ID) } seen[id] = true } } if len(seen) != 506 || !seen["🧑‍🚀"] || !seen["🐐"] || !seen["🎉"] { t.Fatalf("catalog missing entries: %d", len(seen)) } } func TestKissChoices(t *testing.T) { want := map[string]string{ "😘": "Blowing kiss", "💏": "Kiss", "💋": "Kiss mark", "😗": "Kissing face", "😚": "Kissing face with closed eyes", "😙": "Kissing face with smiling eyes", } for _, category := range Categories() { for _, entry := range category.Entries { if label, ok := want[entry.ID]; ok { if entry.Label != label || category.ID != "people" { t.Fatalf("unexpected kiss choice: %#v in %q", entry, category.ID) } delete(want, entry.ID) } } } if len(want) != 0 { t.Fatalf("missing kiss choices: %v", want) } } func TestCategoriesReturnIndependentSlices(t *testing.T) { first := Categories() first[0].ID = "changed" first[0].Entries[0].Label = "changed" second := Categories() if second[0].ID == "changed" || second[0].Entries[0].Label == "changed" { t.Fatal("caller changed shared catalog") } }