(t *testing.T)
| 79 | } |
| 80 | |
| 81 | func TestCloneRun(t *testing.T) { |
| 82 | tests := []struct { |
| 83 | name string |
| 84 | tty bool |
| 85 | opts *cloneOptions |
| 86 | httpStubs func(*httpmock.Registry) |
| 87 | wantStdout string |
| 88 | wantErr bool |
| 89 | wantErrMsg string |
| 90 | }{ |
| 91 | { |
| 92 | name: "clones all labels", |
| 93 | tty: true, |
| 94 | opts: &cloneOptions{SourceRepo: ghrepo.New("cli", "cli")}, |
| 95 | httpStubs: func(reg *httpmock.Registry) { |
| 96 | reg.Register( |
| 97 | httpmock.GraphQL(`query LabelList\b`), |
| 98 | httpmock.GraphQLQuery(` |
| 99 | { |
| 100 | "data": { |
| 101 | "repository": { |
| 102 | "labels": { |
| 103 | "totalCount": 2, |
| 104 | "nodes": [ |
| 105 | { |
| 106 | "name": "bug", |
| 107 | "color": "d73a4a", |
| 108 | "description": "Something isn't working" |
| 109 | }, |
| 110 | { |
| 111 | "name": "docs", |
| 112 | "color": "6cafc9" |
| 113 | } |
| 114 | ], |
| 115 | "pageInfo": { |
| 116 | "hasNextPage": false, |
| 117 | "endCursor": "abcd1234" |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | }`, func(s string, m map[string]interface{}) { |
| 123 | expected := map[string]interface{}{ |
| 124 | "owner": "cli", |
| 125 | "repo": "cli", |
| 126 | "orderBy": map[string]interface{}{ |
| 127 | "direction": "ASC", |
| 128 | "field": "CREATED_AT", |
| 129 | }, |
| 130 | "query": "", |
| 131 | "limit": float64(100), |
| 132 | } |
| 133 | assert.Equal(t, expected, m) |
| 134 | }), |
| 135 | ) |
| 136 | reg.Register( |
| 137 | httpmock.REST("POST", "repos/OWNER/REPO/labels"), |
| 138 | httpmock.StatusStringResponse(201, ` |
nothing calls this directly
no test coverage detected