mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-12-05 23:18:28 +02:00
Use DiffContextSize in ShowStashEntryCmdStr
This commit is contained in:
@@ -33,3 +33,37 @@ func TestGitCommandStashSave(t *testing.T) {
|
||||
|
||||
assert.NoError(t, gitCmd.StashSave("A stash message"))
|
||||
}
|
||||
|
||||
// TestGitCommandShowStashEntryCmdStr is a function.
|
||||
func TestGitCommandShowStashEntryCmdStr(t *testing.T) {
|
||||
type scenario struct {
|
||||
testName string
|
||||
index int
|
||||
contextSize int
|
||||
expected string
|
||||
}
|
||||
|
||||
scenarios := []scenario{
|
||||
{
|
||||
testName: "Default case",
|
||||
index: 5,
|
||||
contextSize: 3,
|
||||
expected: "git stash show -p --stat --color=always --unified=3 stash@{5}",
|
||||
},
|
||||
{
|
||||
testName: "Show diff with custom context size",
|
||||
index: 5,
|
||||
contextSize: 77,
|
||||
expected: "git stash show -p --stat --color=always --unified=77 stash@{5}",
|
||||
},
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
gitCmd := NewDummyGitCommand()
|
||||
gitCmd.Config.GetUserConfig().Git.DiffContextSize = s.contextSize
|
||||
cmdStr := gitCmd.ShowStashEntryCmdStr(s.index)
|
||||
assert.Equal(t, s.expected, cmdStr)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user