fix specs

This commit is contained in:
Jesse Duffield 2018-09-19 19:23:31 +10:00
parent fcaf4e339c
commit 64f0eeb42e

View file

@ -1225,7 +1225,7 @@ func TestGitCommandRemoveFile(t *testing.T) {
testName string testName string
command func() (func(string, ...string) *exec.Cmd, *[][]string) command func() (func(string, ...string) *exec.Cmd, *[][]string)
test func(*[][]string, error) test func(*[][]string, error)
file File file *File
removeFile func(string) error removeFile func(string) error
} }
@ -1247,7 +1247,7 @@ func TestGitCommandRemoveFile(t *testing.T) {
{"reset", "--", "test"}, {"reset", "--", "test"},
}) })
}, },
File{ &File{
Name: "test", Name: "test",
HasStagedChanges: true, HasStagedChanges: true,
}, },
@ -1270,7 +1270,7 @@ func TestGitCommandRemoveFile(t *testing.T) {
assert.EqualError(t, err, "an error occurred when removing file") assert.EqualError(t, err, "an error occurred when removing file")
assert.Len(t, *cmdsCalled, 0) assert.Len(t, *cmdsCalled, 0)
}, },
File{ &File{
Name: "test", Name: "test",
Tracked: false, Tracked: false,
}, },
@ -1295,7 +1295,7 @@ func TestGitCommandRemoveFile(t *testing.T) {
{"checkout", "--", "test"}, {"checkout", "--", "test"},
}) })
}, },
File{ &File{
Name: "test", Name: "test",
Tracked: true, Tracked: true,
HasStagedChanges: false, HasStagedChanges: false,
@ -1321,7 +1321,7 @@ func TestGitCommandRemoveFile(t *testing.T) {
{"checkout", "--", "test"}, {"checkout", "--", "test"},
}) })
}, },
File{ &File{
Name: "test", Name: "test",
Tracked: true, Tracked: true,
HasStagedChanges: false, HasStagedChanges: false,
@ -1348,7 +1348,7 @@ func TestGitCommandRemoveFile(t *testing.T) {
{"checkout", "--", "test"}, {"checkout", "--", "test"},
}) })
}, },
File{ &File{
Name: "test", Name: "test",
Tracked: true, Tracked: true,
HasStagedChanges: true, HasStagedChanges: true,
@ -1374,7 +1374,7 @@ func TestGitCommandRemoveFile(t *testing.T) {
{"reset", "--", "test"}, {"reset", "--", "test"},
}) })
}, },
File{ &File{
Name: "test", Name: "test",
Tracked: false, Tracked: false,
HasStagedChanges: true, HasStagedChanges: true,
@ -1398,7 +1398,7 @@ func TestGitCommandRemoveFile(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
assert.Len(t, *cmdsCalled, 0) assert.Len(t, *cmdsCalled, 0)
}, },
File{ &File{
Name: "test", Name: "test",
Tracked: false, Tracked: false,
HasStagedChanges: false, HasStagedChanges: false,
@ -1484,7 +1484,7 @@ func TestGitCommandGetCommits(t *testing.T) {
type scenario struct { type scenario struct {
testName string testName string
command func(string, ...string) *exec.Cmd command func(string, ...string) *exec.Cmd
test func([]Commit) test func([]*Commit)
} }
scenarios := []scenario{ scenarios := []scenario{
@ -1504,7 +1504,7 @@ func TestGitCommandGetCommits(t *testing.T) {
return nil return nil
}, },
func(commits []Commit) { func(commits []*Commit) {
assert.Len(t, commits, 0) assert.Len(t, commits, 0)
}, },
}, },
@ -1524,9 +1524,9 @@ func TestGitCommandGetCommits(t *testing.T) {
return nil return nil
}, },
func(commits []Commit) { func(commits []*Commit) {
assert.Len(t, commits, 2) assert.Len(t, commits, 2)
assert.EqualValues(t, []Commit{ assert.EqualValues(t, []*Commit{
{ {
Sha: "8a2bb0e", Sha: "8a2bb0e",
Name: "commit 1", Name: "commit 1",