diff options
Diffstat (limited to 'pkg/commands/stash_entries_test.go')
-rw-r--r-- | pkg/commands/stash_entries_test.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/pkg/commands/stash_entries_test.go b/pkg/commands/stash_entries_test.go new file mode 100644 index 000000000..bb4778dc6 --- /dev/null +++ b/pkg/commands/stash_entries_test.go @@ -0,0 +1,35 @@ +package commands + +import ( + "os/exec" + "testing" + + "github.com/jesseduffield/lazygit/pkg/secureexec" + "github.com/stretchr/testify/assert" +) + +// TestGitCommandStashDo is a function. +func TestGitCommandStashDo(t *testing.T) { + gitCmd := NewDummyGitCommand() + gitCmd.OSCommand.Command = func(cmd string, args ...string) *exec.Cmd { + assert.EqualValues(t, "git", cmd) + assert.EqualValues(t, []string{"stash", "drop", "stash@{1}"}, args) + + return secureexec.Command("echo") + } + + assert.NoError(t, gitCmd.StashDo(1, "drop")) +} + +// TestGitCommandStashSave is a function. +func TestGitCommandStashSave(t *testing.T) { + gitCmd := NewDummyGitCommand() + gitCmd.OSCommand.Command = func(cmd string, args ...string) *exec.Cmd { + assert.EqualValues(t, "git", cmd) + assert.EqualValues(t, []string{"stash", "save", "A stash message"}, args) + + return secureexec.Command("echo") + } + + assert.NoError(t, gitCmd.StashSave("A stash message")) +} |