diff --git a/pkg/gui/presentation/commits_test.go b/pkg/gui/presentation/commits_test.go index eb5365f03..7efb5c5ae 100644 --- a/pkg/gui/presentation/commits_test.go +++ b/pkg/gui/presentation/commits_test.go @@ -274,6 +274,12 @@ func TestGetCommitListDisplayStrings(t *testing.T) { bisectInfo: git_commands.NewNullBisectInfo(), cherryPickedCommitHashSet: set.New[string](), now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), + /* EXPECTED: + expected: formatExpected(` + hash4 ○ commit4 + hash5 ○ commit5 + `), + ACTUAL: */ expected: formatExpected(` hash4 ○ commit4 hash5 ○ commit5 @@ -338,6 +344,31 @@ func TestGetCommitListDisplayStrings(t *testing.T) { hash2 pick commit2 `), }, + { + testName: "only showing TODO commits that have no hash", + commitOpts: []models.NewCommitOpts{ + {Name: "refs/heads/branch1", Action: todo.UpdateRef}, + {Name: "refs/heads/branch2", Action: todo.UpdateRef}, + {Name: "commit1", Hash: "hash1", Parents: []string{"hash2"}, Action: todo.Pick}, + {Name: "commit2", Hash: "hash2", Parents: []string{"hash3"}}, + }, + startIdx: 0, + endIdx: 2, + showGraph: false, + bisectInfo: git_commands.NewNullBisectInfo(), + cherryPickedCommitHashSet: set.New[string](), + now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), + /* EXPECTED: + expected: formatExpected(` + update-ref branch1 + update-ref branch2 + `), + ACTUAL: */ + expected: formatExpected(` + update-ref branch1 + update-ref branch2 + `), + }, { testName: "graph in divergence view - all commits visible", commitOpts: []models.NewCommitOpts{ @@ -530,6 +561,30 @@ func TestGetCommitListDisplayStrings(t *testing.T) { hash2 2019-12-20 Jesse Duffield commit2 `), }, + { + testName: "only showing commits from today", + commitOpts: []models.NewCommitOpts{ + {Name: "commit1", Hash: "hash1", UnixTimestamp: 1577844184, AuthorName: "Jesse Duffield"}, + {Name: "commit2", Hash: "hash2", UnixTimestamp: 1576844184, AuthorName: "Jesse Duffield"}, + }, + fullDescription: true, + timeFormat: "2006-01-02", + shortTimeFormat: "3:04PM", + startIdx: 0, + endIdx: 1, + showGraph: false, + bisectInfo: git_commands.NewNullBisectInfo(), + cherryPickedCommitHashSet: set.New[string](), + now: time.Date(2020, 1, 1, 5, 3, 4, 0, time.UTC), + /* EXPECTED: + expected: formatExpected(` + hash1 2:03AM Jesse Duffield commit1 + `), + ACTUAL: */ + expected: formatExpected(` + hash1 2:03AM Jesse Duffield commit1 + `), + }, } oldColorLevel := color.ForceSetColorLevel(terminfo.ColorLevelNone)