photoprism/internal/query/folders_test.go
Michael Mayer a91206a509 Universal sidecar configuration, indexing with multiple roots #268 #348
Slowly getting to the point where only very few people are able to maintain this codebase :)

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-06-07 10:09:35 +02:00

47 lines
845 B
Go

package query
import (
"testing"
"github.com/photoprism/photoprism/internal/entity"
"github.com/stretchr/testify/assert"
)
func TestFoldersByPath(t *testing.T) {
t.Run("root", func(t *testing.T) {
folders, err := FoldersByPath(entity.RootOriginals, "testdata", "", false)
t.Logf("folders: %+v", folders)
if err != nil {
t.Fatal(err)
}
assert.Len(t, folders, 1)
})
t.Run("subdirectory", func(t *testing.T) {
folders, err := FoldersByPath(entity.RootOriginals, "testdata", "directory", false)
t.Logf("folders: %+v", folders)
if err != nil {
t.Fatal(err)
}
assert.Len(t, folders, 2)
})
}
func TestAlbumFolders(t *testing.T) {
t.Run("root", func(t *testing.T) {
folders, err := AlbumFolders(1)
if err != nil {
t.Fatal(err)
}
assert.Len(t, folders, 1)
t.Logf("folders: %+v", folders)
})
}