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

Function TestGetAllCommentEvents

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

Source from the content-addressed store, hash-verified

8)
9
10func TestGetAllCommentEvents(t *testing.T) {
11 events := GetAllCommentEvents()
12
13 // Should have exactly 7 events (added pull_request_comment, discussion, discussion_comment)
14 if len(events) != 7 {
15 t.Errorf("Expected 7 comment events, got %d", len(events))
16 }
17
18 // Check that all expected events are present
19 expectedEvents := map[string][]string{
20 "issues": {"opened", "edited", "reopened"},
21 "issue_comment": {"created", "edited"},
22 "pull_request_comment": {"created", "edited"},
23 "pull_request": {"opened", "edited", "reopened"},
24 "pull_request_review_comment": {"created", "edited"},
25 "discussion": {"created", "edited"},
26 "discussion_comment": {"created", "edited"},
27 }
28
29 for _, event := range events {
30 expected, ok := expectedEvents[event.EventName]
31 if !ok {
32 t.Errorf("Unexpected event name: %s", event.EventName)
33 continue
34 }
35
36 if !reflect.DeepEqual(event.Types, expected) {
37 t.Errorf("For event %s, expected types %v, got %v", event.EventName, expected, event.Types)
38 }
39 }
40}
41
42func TestGetCommentEventByIdentifier(t *testing.T) {
43 tests := []struct {

Callers

nothing calls this directly

Calls 2

GetAllCommentEventsFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected