forked from longtao.wu/droboticflow
24 lines
612 B
Go
24 lines
612 B
Go
package api
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"droboticflow/internal/domain"
|
|
)
|
|
|
|
func TestPaginateObjectStorageItemsUsesLastKeyAsMarker(t *testing.T) {
|
|
items := []domain.ObjectStorageObjectSummary{
|
|
{Key: "a"},
|
|
{Key: "b"},
|
|
{Key: "c"},
|
|
}
|
|
first := paginateObjectStorageItems(items, "", 2)
|
|
if len(first.Items) != 2 || first.NextMarker != "b" || !first.HasMore {
|
|
t.Fatalf("first page = %#v", first)
|
|
}
|
|
second := paginateObjectStorageItems(items, first.NextMarker, 2)
|
|
if len(second.Items) != 1 || second.Items[0].Key != "c" || second.NextMarker != "" || second.HasMore {
|
|
t.Fatalf("second page = %#v", second)
|
|
}
|
|
}
|