diff options
Diffstat (limited to 'pkg/commands/git_commands/branch_loader_test.go')
-rw-r--r-- | pkg/commands/git_commands/branch_loader_test.go | 102 |
1 files changed, 57 insertions, 45 deletions
diff --git a/pkg/commands/git_commands/branch_loader_test.go b/pkg/commands/git_commands/branch_loader_test.go index 9e56666fe..2236374e5 100644 --- a/pkg/commands/git_commands/branch_loader_test.go +++ b/pkg/commands/git_commands/branch_loader_test.go @@ -25,89 +25,101 @@ func TestObtainBranch(t *testing.T) { scenarios := []scenario{ { testName: "TrimHeads", - input: []string{"", "heads/a_branch", "", "", "subject", "123", timeStamp}, + input: []string{"", "heads/a_branch", "", "", "", "subject", "123", timeStamp}, storeCommitDateAsRecency: false, expectedBranch: &models.Branch{ - Name: "a_branch", - Pushables: "?", - Pullables: "?", - Head: false, - Subject: "subject", - CommitHash: "123", + Name: "a_branch", + AheadForPull: "?", + BehindForPull: "?", + AheadForPush: "?", + BehindForPush: "?", + Head: false, + Subject: "subject", + CommitHash: "123", }, }, { testName: "NoUpstream", - input: []string{"", "a_branch", "", "", "subject", "123", timeStamp}, + input: []string{"", "a_branch", "", "", "", "subject", "123", timeStamp}, storeCommitDateAsRecency: false, expectedBranch: &models.Branch{ - Name: "a_branch", - Pushables: "?", - Pullables: "?", - Head: false, - Subject: "subject", - CommitHash: "123", + Name: "a_branch", + AheadForPull: "?", + BehindForPull: "?", + AheadForPush: "?", + BehindForPush: "?", + Head: false, + Subject: "subject", + CommitHash: "123", }, }, { testName: "IsHead", - input: []string{"*", "a_branch", "", "", "subject", "123", timeStamp}, + input: []string{"*", "a_branch", "", "", "", "subject", "123", timeStamp}, storeCommitDateAsRecency: false, expectedBranch: &models.Branch{ - Name: "a_branch", - Pushables: "?", - Pullables: "?", - Head: true, - Subject: "subject", - CommitHash: "123", + Name: "a_branch", + AheadForPull: "?", + BehindForPull: "?", + AheadForPush: "?", + BehindForPush: "?", + Head: true, + Subject: "subject", + CommitHash: "123", }, }, { testName: "IsBehindAndAhead", - input: []string{"", "a_branch", "a_remote/a_branch", "[behind 2, ahead 3]", "subject", "123", timeStamp}, + input: []string{"", "a_branch", "a_remote/a_branch", "[behind 2, ahead 3]", "[behind 2, ahead 3]", "subject", "123", timeStamp}, storeCommitDateAsRecency: false, expectedBranch: &models.Branch{ - Name: "a_branch", - Pushables: "3", - Pullables: "2", - Head: false, - Subject: "subject", - CommitHash: "123", + Name: "a_branch", + AheadForPull: "3", + BehindForPull: "2", + AheadForPush: "3", + BehindForPush: "2", + Head: false, + Subject: "subject", + CommitHash: "123", }, }, { testName: "RemoteBranchIsGone", - input: []string{"", "a_branch", "a_remote/a_branch", "[gone]", "subject", "123", timeStamp}, + input: []string{"", "a_branch", "a_remote/a_branch", "[gone]", "[gone]", "subject", "123", timeStamp}, storeCommitDateAsRecency: false, expectedBranch: &models.Branch{ - Name: "a_branch", - UpstreamGone: true, - Pushables: "?", - Pullables: "?", - Head: false, - Subject: "subject", - CommitHash: "123", + Name: "a_branch", + UpstreamGone: true, + AheadForPull: "?", + BehindForPull: "?", + AheadForPush: "?", + BehindForPush: "?", + Head: false, + Subject: "subject", + CommitHash: "123", }, }, { testName: "WithCommitDateAsRecency", - input: []string{"", "a_branch", "", "", "subject", "123", timeStamp}, + input: []string{"", "a_branch", "", "", "", "subject", "123", timeStamp}, storeCommitDateAsRecency: true, expectedBranch: &models.Branch{ - Name: "a_branch", - Recency: "2h", - Pushables: "?", - Pullables: "?", - Head: false, - Subject: "subject", - CommitHash: "123", + Name: "a_branch", + Recency: "2h", + AheadForPull: "?", + BehindForPull: "?", + AheadForPush: "?", + BehindForPush: "?", + Head: false, + Subject: "subject", + CommitHash: "123", }, }, } for _, s := range scenarios { t.Run(s.testName, func(t *testing.T) { - branch := obtainBranch(s.input, s.storeCommitDateAsRecency) + branch := obtainBranch(s.input, s.storeCommitDateAsRecency, true) assert.EqualValues(t, s.expectedBranch, branch) }) } |