(t *testing.T)
| 810 | } |
| 811 | |
| 812 | func TestRunListWeb_Empty(t *testing.T) { |
| 813 | defer gock.Off() |
| 814 | gock.Observe(gock.DumpRequest) |
| 815 | |
| 816 | // get viewer ID |
| 817 | gock.New("https://api.github.com"). |
| 818 | Post("/graphql"). |
| 819 | MatchType("json"). |
| 820 | JSON(map[string]interface{}{ |
| 821 | "query": "query Viewer.*", |
| 822 | }). |
| 823 | Reply(200). |
| 824 | JSON(map[string]interface{}{ |
| 825 | "data": map[string]interface{}{ |
| 826 | "viewer": map[string]interface{}{ |
| 827 | "id": "an ID", |
| 828 | "login": "theviewer", |
| 829 | }, |
| 830 | }, |
| 831 | }) |
| 832 | |
| 833 | client := queries.NewTestClient() |
| 834 | buf := bytes.Buffer{} |
| 835 | config := listConfig{ |
| 836 | opts: listOpts{ |
| 837 | web: true, |
| 838 | }, |
| 839 | URLOpener: func(url string) error { |
| 840 | buf.WriteString(url) |
| 841 | return nil |
| 842 | }, |
| 843 | client: client, |
| 844 | } |
| 845 | |
| 846 | err := runList(config) |
| 847 | assert.NoError(t, err) |
| 848 | assert.Equal(t, "https://github.com/users/theviewer/projects", buf.String()) |
| 849 | } |
| 850 | |
| 851 | func TestRunListWeb_Closed(t *testing.T) { |
| 852 | defer gock.Off() |
nothing calls this directly
no test coverage detected