(t *testing.T)
| 849 | } |
| 850 | |
| 851 | func TestRunListWeb_Closed(t *testing.T) { |
| 852 | defer gock.Off() |
| 853 | gock.Observe(gock.DumpRequest) |
| 854 | |
| 855 | // get viewer ID |
| 856 | gock.New("https://api.github.com"). |
| 857 | Post("/graphql"). |
| 858 | MatchType("json"). |
| 859 | JSON(map[string]any{ |
| 860 | "query": "query Viewer.*", |
| 861 | }). |
| 862 | Reply(200). |
| 863 | JSON(map[string]any{ |
| 864 | "data": map[string]any{ |
| 865 | "viewer": map[string]any{ |
| 866 | "id": "an ID", |
| 867 | "login": "theviewer", |
| 868 | }, |
| 869 | }, |
| 870 | }) |
| 871 | |
| 872 | client := queries.NewTestClient() |
| 873 | buf := bytes.Buffer{} |
| 874 | config := listConfig{ |
| 875 | opts: listOpts{ |
| 876 | web: true, |
| 877 | closed: true, |
| 878 | }, |
| 879 | URLOpener: func(url string) error { |
| 880 | buf.WriteString(url) |
| 881 | return nil |
| 882 | }, |
| 883 | client: client, |
| 884 | } |
| 885 | |
| 886 | err := runList(config) |
| 887 | assert.NoError(t, err) |
| 888 | assert.Equal(t, "https://github.com/users/theviewer/projects?query=is%3Aclosed", buf.String()) |
| 889 | } |
| 890 | |
| 891 | func TestRunList_JSON(t *testing.T) { |
| 892 | defer gock.Off() |
nothing calls this directly
no test coverage detected