(t *testing.T)
| 141 | } |
| 142 | |
| 143 | func 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 | |
| 178 | func TestParseReactionConfigMap(t *testing.T) { |
| 179 | reaction, issues, pullRequests, discussions, err := parseReactionConfig(map[string]any{ |
nothing calls this directly
no test coverage detected