(t *testing.T)
| 40 | } |
| 41 | |
| 42 | func TestGetValidReactions(t *testing.T) { |
| 43 | reactions := getValidReactions() |
| 44 | |
| 45 | if len(reactions) == 0 { |
| 46 | t.Error("getValidReactions() returned empty slice") |
| 47 | } |
| 48 | |
| 49 | expectedReactions := []string{"+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", "eyes", "none"} |
| 50 | if len(reactions) != len(expectedReactions) { |
| 51 | t.Errorf("getValidReactions() returned %d reactions, want %d", len(reactions), len(expectedReactions)) |
| 52 | } |
| 53 | |
| 54 | // Sort both slices for comparison |
| 55 | sort.Strings(reactions) |
| 56 | sort.Strings(expectedReactions) |
| 57 | |
| 58 | for i, expected := range expectedReactions { |
| 59 | if reactions[i] != expected { |
| 60 | t.Errorf("getValidReactions()[%d] = %q, want %q", i, reactions[i], expected) |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | // Verify all returned reactions are valid |
| 65 | for _, reaction := range reactions { |
| 66 | if !isValidReaction(reaction) { |
| 67 | t.Errorf("getValidReactions() returned invalid reaction: %q", reaction) |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | func TestValidReactionsMap(t *testing.T) { |
| 73 | // Test that the validReactions map contains expected entries |
nothing calls this directly
no test coverage detected