photoprism/internal/query/file_syncs_test.go

34 lines
646 B
Go
Raw Normal View History

2020-05-13 10:16:12 +02:00
package query
import (
2020-11-21 18:08:41 +01:00
"testing"
2020-05-13 10:16:12 +02:00
"github.com/photoprism/photoprism/internal/entity"
"github.com/stretchr/testify/assert"
)
func TestFileSyncs(t *testing.T) {
t.Run("success", func(t *testing.T) {
2021-07-22 15:05:23 +02:00
r, err := FileSyncs(uint(1000001), "downloaded", 10)
2020-05-13 10:16:12 +02:00
if err != nil {
t.Fatal(err)
}
assert.LessOrEqual(t, 1, len(r))
for _, r := range r {
assert.IsType(t, entity.FileSync{}, r)
}
})
t.Run("search for all file syncs", func(t *testing.T) {
r, err := FileSyncs(0, "", 10)
if err != nil {
t.Fatal(err)
}
assert.LessOrEqual(t, 2, len(r))
for _, r := range r {
assert.IsType(t, entity.FileSync{}, r)
}
})
}