Skip to content

Commit d4e14be

Browse files
committed
remove unwanted tests and unwanted functionality
1 parent 8f1c467 commit d4e14be

File tree

2 files changed

+3
-58
lines changed

2 files changed

+3
-58
lines changed

pkg/cmd/gist/edit/edit.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ type EditOptions struct {
2929
Config func() (config.Config, error)
3030

3131
Edit func(string, string, string, *iostreams.IOStreams) (string, error)
32-
Add func(string, string, *iostreams.IOStreams) (string, error)
3332
Selector string
3433
EditFilename string
3534
AddFilename string
@@ -47,13 +46,6 @@ func NewCmdEdit(f *cmdutil.Factory, runF func(*EditOptions) error) *cobra.Comman
4746
defaultContent,
4847
io.In, io.Out, io.ErrOut, nil)
4948
},
50-
Add: func(editorCmd, filename string, io *iostreams.IOStreams) (string, error) {
51-
return surveyext.Edit(
52-
editorCmd,
53-
"*."+filename,
54-
"",
55-
io.In, io.Out, io.ErrOut, nil)
56-
},
5749
}
5850

5951
cmd := &cobra.Command{

pkg/cmd/gist/edit/edit_test.go

Lines changed: 3 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
)
2020

2121
const (
22-
fixtureFile = "../fixture.txt"
22+
fixtureFile = "../fixture.txt"
2323
)
2424

2525
func Test_getFilesToAdd(t *testing.T) {
@@ -243,7 +243,7 @@ func Test_editRun(t *testing.T) {
243243
wantStderr: "You do not own this gist.",
244244
},
245245
{
246-
name: "add file to existing gist with absolute path",
246+
name: "add file to existing gist",
247247
gist: &shared.Gist{
248248
ID: "1234",
249249
Files: map[string]*shared.GistFile{
@@ -260,50 +260,7 @@ func Test_editRun(t *testing.T) {
260260
httpmock.StatusStringResponse(201, "{}"))
261261
},
262262
opts: &EditOptions{
263-
AddFilename: "/Users/octocat/foo.txt",
264-
},
265-
wantParams: map[string]interface{}{
266-
"description": "",
267-
"updated_at": "0001-01-01T00:00:00Z",
268-
"public": false,
269-
"files": map[string]interface{}{
270-
"foo.txt": map[string]interface{}{
271-
"content": "new content to existing gist",
272-
"filename": "foo.txt",
273-
},
274-
},
275-
},
276-
},
277-
{
278-
name: "add file to existing gist with relative path",
279-
gist: &shared.Gist{
280-
ID: "1234",
281-
Files: map[string]*shared.GistFile{
282-
"sample.txt": {
283-
Filename: "sample.txt",
284-
Content: "bwhiizzzbwhuiiizzzz",
285-
Type: "text/plain",
286-
},
287-
},
288-
Owner: &shared.GistOwner{Login: "octocat"},
289-
},
290-
httpStubs: func(reg *httpmock.Registry) {
291-
reg.Register(httpmock.REST("POST", "gists/1234"),
292-
httpmock.StatusStringResponse(201, "{}"))
293-
},
294-
opts: &EditOptions{
295-
AddFilename: "../foo.txt",
296-
},
297-
wantParams: map[string]interface{}{
298-
"description": "",
299-
"updated_at": "0001-01-01T00:00:00Z",
300-
"public": false,
301-
"files": map[string]interface{}{
302-
"foo.txt": map[string]interface{}{
303-
"content": "new content to existing gist",
304-
"filename": "foo.txt",
305-
},
306-
},
263+
AddFilename: "../fixture.txt",
307264
},
308265
},
309266
}
@@ -338,10 +295,6 @@ func Test_editRun(t *testing.T) {
338295
return "new file content", nil
339296
}
340297

341-
tt.opts.Add = func(_, _ string, _ *iostreams.IOStreams) (string, error) {
342-
return "new content to existing gist", nil
343-
}
344-
345298
tt.opts.HttpClient = func() (*http.Client, error) {
346299
return &http.Client{Transport: reg}, nil
347300
}

0 commit comments

Comments
 (0)