grafana/pkg/infra/filestorage/api_test.go
Artur Wierzbicki ed924b3d0c
Storage: list filtering and root folder support (#46453)
* git the things: FS api internal changes

* remove filestorage/service.go

* remove filestore flag

* remove dummy fs

* readd fileblob import
2022-03-11 22:08:19 +04:00

37 lines
632 B
Go

package filestorage
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestFilestorageApi_Join(t *testing.T) {
var tests = []struct {
name string
parts []string
expected string
}{
{
name: "multiple parts",
parts: []string{"prefix", "p1", "p2"},
expected: "/prefix/p1/p2",
},
{
name: "no parts",
parts: []string{},
expected: "/",
},
{
name: "a single part",
parts: []string{"prefix"},
expected: "/prefix",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
require.Equal(t, tt.expected, Join(tt.parts...))
})
}
}