photoprism/internal/entity/file_sync_fixtures_test.go
Michael Mayer e3bb8b19dd Routing: Prefix frontend UI routes with /library #840 #2466
Also improves migrations and updates the db schema docs.

Signed-off-by: Michael Mayer <michael@photoprism.app>
2022-10-15 21:54:11 +02:00

37 lines
1.3 KiB
Go

package entity
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestFileSyncMap_Get(t *testing.T) {
t.Run("get existing filesync", func(t *testing.T) {
r := FileSyncFixtures.Get("FileSync1", 0, "")
assert.Equal(t, uint(1000000), r.ServiceID)
assert.Equal(t, "/20200706-092527-Landscape-München-2020.jpg", r.RemoteName)
assert.IsType(t, FileSync{}, r)
})
t.Run("get not existing filesync", func(t *testing.T) {
r := FileSyncFixtures.Get("FileSyncXXX", 123, "new remote name for sync")
assert.Equal(t, uint(123), r.ServiceID)
assert.Equal(t, "new remote name for sync", r.RemoteName)
assert.IsType(t, FileSync{}, r)
})
}
func TestFileSyncMap_Pointer(t *testing.T) {
t.Run("get existing filesync pointer", func(t *testing.T) {
r := FileSyncFixtures.Pointer("FileSync1", 0, "")
assert.Equal(t, uint(1000000), r.ServiceID)
assert.Equal(t, "/20200706-092527-Landscape-München-2020.jpg", r.RemoteName)
assert.IsType(t, &FileSync{}, r)
})
t.Run("get not existing filesync pointer", func(t *testing.T) {
r := FileSyncFixtures.Pointer("FileSyncYYY", 456, "new remote name for sync pointer")
assert.Equal(t, uint(456), r.ServiceID)
assert.Equal(t, "new remote name for sync pointer", r.RemoteName)
assert.IsType(t, &FileSync{}, r)
})
}