@@ -16,15 +16,6 @@ import (
1616 "github.com/stretchr/testify/require"
1717)
1818
19- type issueFeaturesDetectorMock struct {
20- fd.EnabledDetectorMock
21- issueFeatures fd.IssueFeatures
22- }
23-
24- func (md * issueFeaturesDetectorMock ) IssueFeatures () (fd.IssueFeatures , error ) {
25- return md .issueFeatures , nil
26- }
27-
2819func TestNewCmdClose (t * testing.T ) {
2920 // Test shared parsing of issue number / URL.
3021 argparsetest .TestArgParsing (t , NewCmdClose )
@@ -282,71 +273,6 @@ func TestCloseRun(t *testing.T) {
282273 },
283274 wantStderr : "✓ Closed issue OWNER/REPO#13 (The title of the issue)\n " ,
284275 },
285- {
286- name : "close issue with duplicate reason when duplicate is not supported" ,
287- opts : & CloseOptions {
288- IssueNumber : 13 ,
289- Reason : "duplicate" ,
290- Detector : & issueFeaturesDetectorMock {
291- issueFeatures : fd.IssueFeatures {
292- StateReason : true ,
293- StateReasonDuplicate : false ,
294- },
295- },
296- },
297- httpStubs : func (reg * httpmock.Registry ) {
298- reg .Register (
299- httpmock .GraphQL (`query IssueByNumber\b` ),
300- httpmock .StringResponse (`
301- { "data": { "repository": {
302- "hasIssuesEnabled": true,
303- "issue": { "id": "THE-ID", "number": 13, "title": "The title of the issue"}
304- } } }` ),
305- )
306- reg .Register (
307- httpmock .GraphQL (`mutation IssueClose\b` ),
308- httpmock .GraphQLMutation (`{"id": "THE-ID"}` ,
309- func (inputs map [string ]interface {}) {
310- assert .Equal (t , 1 , len (inputs ))
311- assert .Equal (t , "THE-ID" , inputs ["issueId" ])
312- }),
313- )
314- },
315- wantStderr : "✓ Closed issue OWNER/REPO#13 (The title of the issue)\n " ,
316- },
317- {
318- name : "close issue as duplicate when duplicate is not supported" ,
319- opts : & CloseOptions {
320- IssueNumber : 13 ,
321- DuplicateOf : "99" ,
322- Detector : & issueFeaturesDetectorMock {
323- issueFeatures : fd.IssueFeatures {
324- StateReason : true ,
325- StateReasonDuplicate : false ,
326- },
327- },
328- },
329- httpStubs : func (reg * httpmock.Registry ) {
330- reg .Register (
331- httpmock .GraphQL (`query IssueByNumber\b` ),
332- httpmock .StringResponse (`
333- { "data": { "repository": {
334- "hasIssuesEnabled": true,
335- "issue": { "id": "THE-ID", "number": 13, "title": "The title of the issue"}
336- } } }` ),
337- )
338- reg .Register (
339- httpmock .GraphQL (`query IssueByNumber\b` ),
340- httpmock .StringResponse (`
341- { "data": { "repository": {
342- "hasIssuesEnabled": true,
343- "issue": { "id": "DUPLICATE-ID", "number": 99}
344- } } }` ),
345- )
346- },
347- wantErr : true ,
348- errMsg : "closing as duplicate is not supported on github.com" ,
349- },
350276 {
351277 name : "duplicate of cannot point to same issue" ,
352278 opts : & CloseOptions {
0 commit comments