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

Function TestIntToReactionString

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

Source from the content-addressed store, hash-verified

141}
142
143func TestIntToReactionString(t *testing.T) {
144 tests := []struct {
145 name string
146 value int64
147 expected string
148 expectError bool
149 }{
150 {"1 becomes +1", 1, "+1", false},
151 {"-1 becomes -1", -1, "-1", false},
152 {"0 is invalid", 0, "", true},
153 {"2 is invalid", 2, "", true},
154 {"-2 is invalid", -2, "", true},
155 {"100 is invalid", 100, "", true},
156 }
157
158 for _, tt := range tests {
159 t.Run(tt.name, func(t *testing.T) {
160 result, err := intToReactionString(tt.value)
161
162 if tt.expectError {
163 if err == nil {
164 t.Errorf("intToReactionString(%d) expected error, got result %q", tt.value, result)
165 }
166 } else {
167 if err != nil {
168 t.Errorf("intToReactionString(%d) unexpected error: %v", tt.value, err)
169 }
170 if result != tt.expected {
171 t.Errorf("intToReactionString(%d) = %q, want %q", tt.value, result, tt.expected)
172 }
173 }
174 })
175 }
176}
177
178func TestParseReactionConfigMap(t *testing.T) {
179 reaction, issues, pullRequests, discussions, err := parseReactionConfig(map[string]any{

Callers

nothing calls this directly

Calls 3

intToReactionStringFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected