(t *testing.T)
| 77 | } |
| 78 | |
| 79 | func TestRunDeleteField(t *testing.T) { |
| 80 | defer gock.Off() |
| 81 | gock.Observe(gock.DumpRequest) |
| 82 | |
| 83 | // delete Field |
| 84 | gock.New("https://api.github.com"). |
| 85 | Post("/graphql"). |
| 86 | BodyString(`{"query":"mutation DeleteField.*","variables":{"input":{"fieldId":"an ID"}}}`). |
| 87 | Reply(200). |
| 88 | JSON(map[string]interface{}{ |
| 89 | "data": map[string]interface{}{ |
| 90 | "deleteProjectV2Field": map[string]interface{}{ |
| 91 | "projectV2Field": map[string]interface{}{ |
| 92 | "id": "Field ID", |
| 93 | }, |
| 94 | }, |
| 95 | }, |
| 96 | }) |
| 97 | |
| 98 | client := queries.NewTestClient() |
| 99 | |
| 100 | ios, _, stdout, _ := iostreams.Test() |
| 101 | ios.SetStdoutTTY(true) |
| 102 | config := deleteFieldConfig{ |
| 103 | opts: deleteFieldOpts{ |
| 104 | fieldID: "an ID", |
| 105 | }, |
| 106 | client: client, |
| 107 | io: ios, |
| 108 | } |
| 109 | |
| 110 | err := runDeleteField(config) |
| 111 | assert.NoError(t, err) |
| 112 | assert.Equal( |
| 113 | t, |
| 114 | "Deleted field\n", |
| 115 | stdout.String()) |
| 116 | } |
| 117 | |
| 118 | func TestRunDeleteField_JSON(t *testing.T) { |
| 119 | defer gock.Off() |
nothing calls this directly
no test coverage detected