Skip to content

Commit

Permalink
Add a test for ListBranches "prefix" branch
Browse files Browse the repository at this point in the history
Issue #8479 _asks_ for this arg, but it already exists.  It exists and is in
use, but obviously we can do better at promoting it.
  • Loading branch information
arielshaqed committed Jan 10, 2025
1 parent f928a1d commit 4369be5
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions pkg/catalog/catalog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ func TestCatalog_ListBranches(t *testing.T) {
{BranchID: "branch1", Branch: &graveler.Branch{CommitID: "commit1"}},
{BranchID: "branch2", Branch: &graveler.Branch{CommitID: "commit2"}},
{BranchID: "branch3", Branch: &graveler.Branch{CommitID: "commit3"}},
{BranchID: "that_branch", Branch: &graveler.Branch{CommitID: "commit4"}},
}
type args struct {
prefix string
Expand All @@ -336,17 +337,19 @@ func TestCatalog_ListBranches(t *testing.T) {
{Name: "branch1", Reference: "commit1"},
{Name: "branch2", Reference: "commit2"},
{Name: "branch3", Reference: "commit3"},
{Name: "that_branch", Reference: "commit4"},
},
wantHasMore: false,
wantErr: false,
},
{
name: "exact",
args: args{limit: 3},
args: args{limit: 4},
want: []*catalog.Branch{
{Name: "branch1", Reference: "commit1"},
{Name: "branch2", Reference: "commit2"},
{Name: "branch3", Reference: "commit3"},
{Name: "that_branch", Reference: "commit4"},
},
wantHasMore: false,
wantErr: false,
Expand All @@ -370,11 +373,23 @@ func TestCatalog_ListBranches(t *testing.T) {
wantErr: false,
},
{
name: "last2",
name: "tail",
args: args{limit: 10, after: "branch1"},
want: []*catalog.Branch{
{Name: "branch2", Reference: "commit2"},
{Name: "branch3", Reference: "commit3"},
{Name: "that_branch", Reference: "commit4"},
},
wantHasMore: false,
wantErr: false,
},
{
name: "prefix",
args: args{limit: -1, prefix: "branch"},
want: []*catalog.Branch{
{Name: "branch1", Reference: "commit1"},
{Name: "branch2", Reference: "commit2"},
{Name: "branch3", Reference: "commit3"},
},
wantHasMore: false,
wantErr: false,
Expand Down

0 comments on commit 4369be5

Please sign in to comment.