MCPcopy
hub / github.com/cli/cli / TestGetCommentReplies

Function TestGetCommentReplies

pkg/cmd/discussion/client/client_test.go:1815–2341  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1813}
1814
1815func 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",

Callers

nothing calls this directly

Calls 11

RegisterMethod · 0.95
VerifyMethod · 0.95
GraphQLFunction · 0.92
StringResponseFunction · 0.92
newTestDiscussionClientFunction · 0.85
EqualMethod · 0.80
ContainsMethod · 0.80
LenMethod · 0.65
RunMethod · 0.65
GetCommentRepliesMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected