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

Function TestRunListWeb_Closed

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

Source from the content-addressed store, hash-verified

849}
850
851func 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
891func TestRunList_JSON(t *testing.T) {
892 defer gock.Off()

Callers

nothing calls this directly

Calls 5

NewTestClientFunction · 0.92
ReplyMethod · 0.80
EqualMethod · 0.80
runListFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected