diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-11-07 16:35:36 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2023-06-01 19:21:24 +1000 |
commit | a4db44bc3dab55c203c5f4d40c131c9c4adaf793 (patch) | |
tree | 6de159b0fcd225e8c96eebea5e852dc4bbefc6cd /pkg/commands/git_commands/branch_loader_test.go | |
parent | 4b3f8055d0746c44787c6ba026630f29e7f049b5 (diff) |
show commits against branches
Diffstat (limited to 'pkg/commands/git_commands/branch_loader_test.go')
-rw-r--r-- | pkg/commands/git_commands/branch_loader_test.go | 68 |
1 files changed, 52 insertions, 16 deletions
diff --git a/pkg/commands/git_commands/branch_loader_test.go b/pkg/commands/git_commands/branch_loader_test.go index c147c1484..f16dcf5f4 100644 --- a/pkg/commands/git_commands/branch_loader_test.go +++ b/pkg/commands/git_commands/branch_loader_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestObtainBanch(t *testing.T) { +func TestObtainBranch(t *testing.T) { type scenario struct { testName string input []string @@ -17,29 +17,65 @@ func TestObtainBanch(t *testing.T) { scenarios := []scenario{ { - testName: "TrimHeads", - input: []string{"", "heads/a_branch", "", ""}, - expectedBranch: &models.Branch{Name: "a_branch", Pushables: "?", Pullables: "?", Head: false}, + testName: "TrimHeads", + input: []string{"", "heads/a_branch", "", "", "subject", "123"}, + expectedBranch: &models.Branch{ + Name: "a_branch", + Pushables: "?", + Pullables: "?", + Head: false, + Subject: "subject", + CommitHash: "123", + }, }, { - testName: "NoUpstream", - input: []string{"", "a_branch", "", ""}, - expectedBranch: &models.Branch{Name: "a_branch", Pushables: "?", Pullables: "?", Head: false}, + testName: "NoUpstream", + input: []string{"", "a_branch", "", "", "subject", "123"}, + expectedBranch: &models.Branch{ + Name: "a_branch", + Pushables: "?", + Pullables: "?", + Head: false, + Subject: "subject", + CommitHash: "123", + }, }, { - testName: "IsHead", - input: []string{"*", "a_branch", "", ""}, - expectedBranch: &models.Branch{Name: "a_branch", Pushables: "?", Pullables: "?", Head: true}, + testName: "IsHead", + input: []string{"*", "a_branch", "", "", "subject", "123"}, + expectedBranch: &models.Branch{ + Name: "a_branch", + Pushables: "?", + Pullables: "?", + Head: true, + Subject: "subject", + CommitHash: "123", + }, }, { - testName: "IsBehindAndAhead", - input: []string{"", "a_branch", "a_remote/a_branch", "[behind 2, ahead 3]"}, - expectedBranch: &models.Branch{Name: "a_branch", Pushables: "3", Pullables: "2", Head: false}, + testName: "IsBehindAndAhead", + input: []string{"", "a_branch", "a_remote/a_branch", "[behind 2, ahead 3]", "subject", "123"}, + expectedBranch: &models.Branch{ + Name: "a_branch", + Pushables: "3", + Pullables: "2", + Head: false, + Subject: "subject", + CommitHash: "123", + }, }, { - testName: "RemoteBranchIsGone", - input: []string{"", "a_branch", "a_remote/a_branch", "[gone]"}, - expectedBranch: &models.Branch{Name: "a_branch", UpstreamGone: true, Pushables: "?", Pullables: "?", Head: false}, + testName: "RemoteBranchIsGone", + input: []string{"", "a_branch", "a_remote/a_branch", "[gone]", "subject", "123"}, + expectedBranch: &models.Branch{ + Name: "a_branch", + UpstreamGone: true, + Pushables: "?", + Pullables: "?", + Head: false, + Subject: "subject", + CommitHash: "123", + }, }, } |