(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func 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 | |
| 42 | func TestGetValidReactions(t *testing.T) { |
| 43 | reactions := getValidReactions() |
nothing calls this directly
no test coverage detected