2020-05-11 11:01:28 +02:00
|
|
|
package entity
|
2020-05-08 15:41:01 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2022-04-10 14:38:51 +02:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2020-05-08 15:41:01 +02:00
|
|
|
)
|
|
|
|
|
2022-04-10 14:38:51 +02:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2020-05-30 14:52:47 +02:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-08 15:41:01 +02:00
|
|
|
func TestUpdatePhotoCounts(t *testing.T) {
|
2021-10-02 14:24:44 +02:00
|
|
|
err := UpdateCounts()
|
2020-05-08 15:41:01 +02:00
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|