photoprism/internal/query/file_syncs_test.go

34 lines
640 B
Go
Raw Normal View History

2020-05-13 08:16:12 +00:00
package query
import (
2020-11-21 17:08:41 +00:00
"testing"
2020-05-13 08:16:12 +00:00
"github.com/photoprism/photoprism/internal/entity"
"github.com/stretchr/testify/assert"
)
func TestFileSyncs(t *testing.T) {
t.Run("success", func(t *testing.T) {
r, err := FileSyncs(uint(1000001), "test", 10)
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)
}
})
}