photoprism/internal/entity/entity_count_test.go
Michael Mayer b97e0e9c3b Albums: Prevent accidental creation of duplicate albums #2233
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2022-04-10 14:38:51 +02:00

40 lines
636 B
Go

package entity
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestCount(t *testing.T) {
m := PhotoFixtures.Pointer("Photo01")
_, keys, err := ModelValues(m, "ID", "PhotoUID")
if err != nil {
t.Fatal(err)
}
result := Count(m, []string{"ID", "PhotoUID"}, keys)
assert.Equal(t, 1, result)
}
func TestLabelCounts(t *testing.T) {
results := LabelCounts()
if len(results) == 0 {
t.Fatal("at least one result expected")
}
for _, result := range results {
t.Logf("LABEL COUNT: %+v", result)
}
}
func TestUpdatePhotoCounts(t *testing.T) {
err := UpdateCounts()
if err != nil {
t.Fatal(err)
}
}