(t *testing.T)
| 1813 | } |
| 1814 | |
| 1815 | func TestGetCommentReplies(t *testing.T) { |
| 1816 | tests := []struct { |
| 1817 | name string |
| 1818 | commentID string |
| 1819 | limit int |
| 1820 | after string |
| 1821 | newest bool |
| 1822 | httpStubs func(*testing.T, *httpmock.Registry) |
| 1823 | wantErr string |
| 1824 | assertDisc func(*testing.T, *Discussion) |
| 1825 | }{ |
| 1826 | { |
| 1827 | name: "maps all fields", |
| 1828 | commentID: "DC_abc", |
| 1829 | limit: 10, |
| 1830 | newest: false, |
| 1831 | httpStubs: func(t *testing.T, reg *httpmock.Registry) { |
| 1832 | reg.Register( |
| 1833 | httpmock.GraphQL(`query DiscussionCommentReplies\b`), |
| 1834 | httpmock.StringResponse(heredoc.Doc(` |
| 1835 | { |
| 1836 | "data": { |
| 1837 | "node": { |
| 1838 | "id": "DC_abc", |
| 1839 | "url": "https://github.com/OWNER/REPO/discussions/42#discussioncomment-1", |
| 1840 | "author": {"__typename": "User", "login": "octocat", "id": "U_octocat", "name": "Octocat"}, |
| 1841 | "body": "Top-level comment", |
| 1842 | "createdAt": "2025-03-01T00:00:00Z", |
| 1843 | "isAnswer": true, |
| 1844 | "upvoteCount": 5, |
| 1845 | "reactionGroups": [{"content": "HEART", "users": {"totalCount": 2}}], |
| 1846 | "discussion": { |
| 1847 | "id": "D_1", |
| 1848 | "number": 42, |
| 1849 | "title": "Test Discussion", |
| 1850 | "body": "Discussion body", |
| 1851 | "url": "https://github.com/OWNER/REPO/discussions/42", |
| 1852 | "closed": true, |
| 1853 | "stateReason": "RESOLVED", |
| 1854 | "isAnswered": true, |
| 1855 | "answerChosenAt": "2025-06-01T12:00:00Z", |
| 1856 | "author": {"__typename": "User", "login": "alice", "id": "U_alice", "name": "Alice"}, |
| 1857 | "category": {"id": "CAT1", "name": "Q&A", "slug": "q-a", "emoji": ":question:", "isAnswerable": true}, |
| 1858 | "answerChosenBy": {"__typename": "User", "login": "bob", "id": "U_bob", "name": "Bob"}, |
| 1859 | "labels": {"nodes": [{"id": "L1", "name": "bug", "color": "d73a4a"}]}, |
| 1860 | "reactionGroups": [{"content": "THUMBS_UP", "users": {"totalCount": 3}}], |
| 1861 | "createdAt": "2025-01-01T00:00:00Z", |
| 1862 | "updatedAt": "2025-01-02T00:00:00Z", |
| 1863 | "closedAt": "2025-06-01T00:00:00Z", |
| 1864 | "locked": true |
| 1865 | }, |
| 1866 | "replies": { |
| 1867 | "totalCount": 1, |
| 1868 | "pageInfo": {"endCursor": "REP_CUR", "hasNextPage": true, "startCursor": "REP_START", "hasPreviousPage": false}, |
| 1869 | "nodes": [ |
| 1870 | { |
| 1871 | "id": "R1", |
| 1872 | "url": "https://github.com/OWNER/REPO/discussions/42#discussioncomment-2", |
nothing calls this directly
no test coverage detected