mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
better handling of refreshed files
This commit is contained in:
@ -461,87 +461,6 @@ func TestGitCommandCommitAmend(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
// TestGitCommandMergeStatusFiles is a function.
|
||||
func TestGitCommandMergeStatusFiles(t *testing.T) {
|
||||
type scenario struct {
|
||||
testName string
|
||||
oldFiles []*models.File
|
||||
newFiles []*models.File
|
||||
test func([]*models.File)
|
||||
}
|
||||
|
||||
scenarios := []scenario{
|
||||
{
|
||||
"Old file and new file are the same",
|
||||
[]*models.File{},
|
||||
[]*models.File{
|
||||
{
|
||||
Name: "new_file.txt",
|
||||
},
|
||||
},
|
||||
func(files []*models.File) {
|
||||
expected := []*models.File{
|
||||
{
|
||||
Name: "new_file.txt",
|
||||
},
|
||||
}
|
||||
|
||||
assert.Len(t, files, 1)
|
||||
assert.EqualValues(t, expected, files)
|
||||
},
|
||||
},
|
||||
{
|
||||
"Several files to merge, with some identical",
|
||||
[]*models.File{
|
||||
{
|
||||
Name: "new_file1.txt",
|
||||
},
|
||||
{
|
||||
Name: "new_file2.txt",
|
||||
},
|
||||
{
|
||||
Name: "new_file3.txt",
|
||||
},
|
||||
},
|
||||
[]*models.File{
|
||||
{
|
||||
Name: "new_file4.txt",
|
||||
},
|
||||
{
|
||||
Name: "new_file5.txt",
|
||||
},
|
||||
{
|
||||
Name: "new_file1.txt",
|
||||
},
|
||||
},
|
||||
func(files []*models.File) {
|
||||
expected := []*models.File{
|
||||
{
|
||||
Name: "new_file1.txt",
|
||||
},
|
||||
{
|
||||
Name: "new_file4.txt",
|
||||
},
|
||||
{
|
||||
Name: "new_file5.txt",
|
||||
},
|
||||
}
|
||||
|
||||
assert.Len(t, files, 3)
|
||||
assert.EqualValues(t, expected, files)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
gitCmd := NewDummyGitCommand()
|
||||
|
||||
s.test(gitCmd.MergeStatusFiles(s.oldFiles, s.newFiles, nil))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestGitCommandGetCommitDifferences is a function.
|
||||
func TestGitCommandGetCommitDifferences(t *testing.T) {
|
||||
type scenario struct {
|
||||
|
Reference in New Issue
Block a user