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

Function TestIsValidReaction

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

Source from the content-addressed store, hash-verified

8)
9
10func TestIsValidReaction(t *testing.T) {
11 tests := []struct {
12 name string
13 reaction string
14 expected bool
15 }{
16 {"+1 is valid", "+1", true},
17 {"-1 is valid", "-1", true},
18 {"laugh is valid", "laugh", true},
19 {"confused is valid", "confused", true},
20 {"heart is valid", "heart", true},
21 {"hooray is valid", "hooray", true},
22 {"rocket is valid", "rocket", true},
23 {"eyes is valid", "eyes", true},
24 {"none is valid", "none", true},
25 {"invalid reaction", "thumbsup", false},
26 {"empty string is invalid", "", false},
27 {"random string is invalid", "random", false},
28 {"case sensitive - uppercase invalid", "HEART", false},
29 {"case sensitive - mixed case invalid", "Laugh", false},
30 }
31
32 for _, tt := range tests {
33 t.Run(tt.name, func(t *testing.T) {
34 result := isValidReaction(tt.reaction)
35 if result != tt.expected {
36 t.Errorf("isValidReaction(%q) = %v, want %v", tt.reaction, result, tt.expected)
37 }
38 })
39 }
40}
41
42func TestGetValidReactions(t *testing.T) {
43 reactions := getValidReactions()

Callers

nothing calls this directly

Calls 3

isValidReactionFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected