Allow for creating fixup! commits

This commit is contained in:
Jesse Duffield 2019-04-07 11:35:34 +10:00
parent b422692746
commit 60e33f5d8c
7 changed files with 159 additions and 6 deletions

View file

@ -2066,3 +2066,38 @@ func TestGitCommandResetHardHead(t *testing.T) {
})
}
}
// TestGitCommandCreateFixupCommit is a function.
func TestGitCommandCreateFixupCommit(t *testing.T) {
type scenario struct {
testName string
sha string
command func(string, ...string) *exec.Cmd
test func(error)
}
scenarios := []scenario{
{
"valid case",
"12345",
test.CreateMockCommand(t, []*test.CommandSwapper{
{
Expect: `git commit --fixup=12345`,
Replace: "echo",
},
}),
func(err error) {
assert.NoError(t, err)
},
},
}
gitCmd := NewDummyGitCommand()
for _, s := range scenarios {
t.Run(s.testName, func(t *testing.T) {
gitCmd.OSCommand.command = s.command
s.test(gitCmd.CreateFixupCommit(s.sha))
})
}
}