photoprism/pkg/sortby/random_test.go
Michael Mayer 47defc861c API: Add sort order "random" to find a random set of photos #153
Signed-off-by: Michael Mayer <michael@photoprism.app>
2023-01-30 12:27:34 +01:00

17 lines
338 B
Go

package sortby
import (
"testing"
"github.com/jinzhu/gorm"
"github.com/stretchr/testify/assert"
)
func TestRandomExpr(t *testing.T) {
mysql, _ := gorm.GetDialect(MySQL)
sqlite3, _ := gorm.GetDialect(SQLite3)
assert.Equal(t, gorm.Expr("RAND()"), RandomExpr(mysql))
assert.Equal(t, gorm.Expr("RANDOM()"), RandomExpr(sqlite3))
}