1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

improve merge conflict flow

This commit is contained in:
Jesse Duffield
2022-01-26 01:20:19 +11:00
parent ce3bcfe37c
commit c8cc18920f
17 changed files with 396 additions and 232 deletions

View File

@ -132,3 +132,32 @@ func TestCompress(t *testing.T) {
})
}
}
func TestGetFile(t *testing.T) {
scenarios := []struct {
name string
viewModel *FileTreeViewModel
path string
expected *models.File
}{
{
name: "valid case",
viewModel: NewFileTreeViewModel([]*models.File{{Name: "blah/one"}, {Name: "blah/two"}}, nil, false),
path: "blah/two",
expected: &models.File{Name: "blah/two"},
},
{
name: "not found",
viewModel: NewFileTreeViewModel([]*models.File{{Name: "blah/one"}, {Name: "blah/two"}}, nil, false),
path: "blah/three",
expected: nil,
},
}
for _, s := range scenarios {
s := s
t.Run(s.name, func(t *testing.T) {
assert.EqualValues(t, s.expected, s.viewModel.GetFile(s.path))
})
}
}