Fix missing date filter (#2434)

This commit is contained in:
WithoutPants
2022-03-29 06:45:46 +11:00
committed by GitHub
parent a2c611f90d
commit 02ee791796
6 changed files with 32 additions and 5 deletions

View File

@@ -4,6 +4,7 @@
package sqlite_test
import (
"math"
"strconv"
"testing"
@@ -562,6 +563,28 @@ func TestGalleryQueryIsMissingTags(t *testing.T) {
})
}
func TestGalleryQueryIsMissingDate(t *testing.T) {
withTxn(func(r models.Repository) error {
sqb := r.Gallery()
isMissing := "date"
galleryFilter := models.GalleryFilterType{
IsMissing: &isMissing,
}
galleries := queryGallery(t, sqb, &galleryFilter, nil)
// three in four scenes have no date
assert.Len(t, galleries, int(math.Ceil(float64(totalGalleries)/4*3)))
// ensure date is null, empty or "0001-01-01"
for _, g := range galleries {
assert.True(t, !g.Date.Valid || g.Date.String == "" || g.Date.String == "0001-01-01")
}
return nil
})
}
func TestGalleryQueryPerformers(t *testing.T) {
withTxn(func(r models.Repository) error {
sqb := r.Gallery()