photoprism/internal/query/duplicates_test.go
Michael Mayer 13bd176f0f Albums: Handle missing entries and pure emoji titles
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-12-27 13:11:08 +01:00

39 lines
778 B
Go

package query
import (
"testing"
"time"
"github.com/photoprism/photoprism/internal/entity"
"github.com/stretchr/testify/assert"
)
func TestCleanDuplicates(t *testing.T) {
fileName := "hd89e5yhb8p9h.jpg"
if err := entity.AddDuplicate(
fileName,
entity.RootOriginals,
"2cad9168fa6acc5c5c2965ddf6ec465ca42fd811",
661858,
time.Date(2019, 3, 6, 2, 6, 51, 0, time.UTC).Unix(),
); err != nil {
t.Fatal(err)
}
d := &entity.Duplicate{FileName: fileName, FileRoot: entity.RootOriginals}
if err := d.Find(); err != nil {
t.Fatal(err)
}
err := CleanDuplicates()
assert.NoError(t, err)
dp := &entity.Duplicate{FileName: fileName, FileRoot: entity.RootOriginals}
if err := dp.Find(); err == nil {
t.Fatalf("duplicate should be removed: %+v", dp)
}
}