(t *testing.T)
| 106 | } |
| 107 | |
| 108 | func TestList(t *testing.T) { |
| 109 | repo := ghrepo.New("OWNER", "REPO") |
| 110 | |
| 111 | richNode := heredoc.Doc(` |
| 112 | { |
| 113 | "id": "D_rich1", |
| 114 | "number": 42, |
| 115 | "title": "Rich discussion", |
| 116 | "body": "body text here", |
| 117 | "url": "https://github.com/OWNER/REPO/discussions/42", |
| 118 | "closed": true, |
| 119 | "stateReason": "RESOLVED", |
| 120 | "isAnswered": true, |
| 121 | "answerChosenAt": "2024-06-01T12:00:00Z", |
| 122 | "author": { |
| 123 | "__typename": "User", |
| 124 | "login": "alice", |
| 125 | "id": "U1", |
| 126 | "name": "Alice" |
| 127 | }, |
| 128 | "category": { |
| 129 | "id": "C1", |
| 130 | "name": "Q&A", |
| 131 | "slug": "q-a", |
| 132 | "emoji": ":question:", |
| 133 | "isAnswerable": true |
| 134 | }, |
| 135 | "answerChosenBy": { |
| 136 | "__typename": "User", |
| 137 | "login": "bob", |
| 138 | "id": "U2", |
| 139 | "name": "Bob" |
| 140 | }, |
| 141 | "labels": { |
| 142 | "nodes": [ |
| 143 | {"id": "L1", "name": "bug", "color": "d73a4a"}, |
| 144 | {"id": "L2", "name": "enhancement", "color": "a2eeef"} |
| 145 | ] |
| 146 | }, |
| 147 | "reactionGroups": [], |
| 148 | "createdAt": "2024-01-01T00:00:00Z", |
| 149 | "updatedAt": "2024-06-02T00:00:00Z", |
| 150 | "closedAt": "2024-06-01T00:00:00Z", |
| 151 | "locked": true |
| 152 | } |
| 153 | `) |
| 154 | |
| 155 | emptyResp := listResp(false, "", 0, "") |
| 156 | disabledResp := heredoc.Doc(` |
| 157 | { |
| 158 | "data": { |
| 159 | "repository": { |
| 160 | "hasDiscussionsEnabled": false, |
| 161 | "discussions": { |
| 162 | "totalCount": 0, |
| 163 | "pageInfo": { |
| 164 | "hasNextPage": false, |
| 165 | "endCursor": null |
nothing calls this directly
no test coverage detected