MCPcopy Create free account
hub / github.com/cli/cli / TestRunList_JSON

Function TestRunList_JSON

pkg/cmd/project/list/list_test.go:891–969  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

889}
890
891func TestRunList_JSON(t *testing.T) {
892 defer gock.Off()
893 gock.Observe(gock.DumpRequest)
894 // get user ID
895 gock.New("https://api.github.com").
896 Post("/graphql").
897 MatchType("json").
898 JSON(map[string]any{
899 "query": "query UserOrgOwner.*",
900 "variables": map[string]any{
901 "login": "monalisa",
902 },
903 }).
904 Reply(200).
905 JSON(map[string]any{
906 "data": map[string]any{
907 "user": map[string]any{
908 "id": "an ID",
909 },
910 },
911 "errors": []any{
912 map[string]any{
913 "type": "NOT_FOUND",
914 "path": []string{"organization"},
915 },
916 },
917 })
918
919 gock.New("https://api.github.com").
920 Post("/graphql").
921 Reply(200).
922 JSON(map[string]any{
923 "data": map[string]any{
924 "user": map[string]any{
925 "login": "monalisa",
926 "projectsV2": map[string]any{
927 "nodes": []any{
928 map[string]any{
929 "title": "Project 1",
930 "shortDescription": "Short description 1",
931 "url": "url1",
932 "closed": false,
933 "ID": "id-1",
934 "number": 1,
935 },
936 map[string]any{
937 "title": "Project 2",
938 "shortDescription": "",
939 "url": "url2",
940 "closed": true,
941 "ID": "id-2",
942 "number": 2,
943 },
944 },
945 "totalCount": 2,
946 },
947 },
948 },

Callers

nothing calls this directly

Calls 6

NewTestClientFunction · 0.92
TestFunction · 0.92
NewJSONExporterFunction · 0.92
ReplyMethod · 0.80
runListFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected