1// Copyright (C) 2020 Storj Labs, Inc.
2// See LICENSE for copying information.
3
4package metaclient_test
5
6import (
7	"testing"
8
9	"github.com/stretchr/testify/require"
10
11	"storj.io/uplink/private/metaclient"
12)
13
14func TestListOptions(t *testing.T) {
15	opts := metaclient.ListOptions{
16		Prefix:    "alpha/",
17		Cursor:    "a",
18		Delimiter: '/',
19		Recursive: true,
20		Direction: metaclient.After,
21		Limit:     30,
22	}
23
24	list := metaclient.ObjectList{
25		Bucket: "hello",
26		Prefix: "alpha/",
27		More:   true,
28		Items: []metaclient.Object{
29			{Path: "alpha/xyz"},
30		},
31	}
32
33	newopts := opts.NextPage(list)
34	require.Equal(t, metaclient.ListOptions{
35		Prefix:    "alpha/",
36		Cursor:    "alpha/xyz",
37		Delimiter: '/',
38		Recursive: true,
39		Direction: metaclient.After,
40		Limit:     30,
41	}, newopts)
42}
43