MCPcopy Create free account
hub / github.com/github/gh-aw / TestGetValidReactions

Function TestGetValidReactions

pkg/workflow/reactions_test.go:42–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

40}
41
42func 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
72func TestValidReactionsMap(t *testing.T) {
73 // Test that the validReactions map contains expected entries

Callers

nothing calls this directly

Calls 4

getValidReactionsFunction · 0.85
isValidReactionFunction · 0.85
ErrorMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected