Small refactoring

- Remove duplication
- Remove warning about builtin keyword `new`
This commit is contained in:
Deluan 2024-09-13 20:18:00 -04:00
parent e8d0f2ec2c
commit e65eb225c8
3 changed files with 23 additions and 9 deletions

View file

@ -1,8 +1,11 @@
package persistence
import (
"context"
"github.com/Masterminds/squirrel"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/model/request"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
@ -151,5 +154,13 @@ var _ = Describe("sqlRepository", func() {
Expect(sql).To(Equal("name asc, coalesce(nullif(release_date, ''), nullif(original_date, '')) desc, status desc"))
})
})
Context("seededRandomSort", func() {
It("returns a random sort order function call", func() {
r.ctx = request.WithUser(context.Background(), model.User{ID: "2"})
r.tableName = "media_file"
sql := r.seededRandomSort()
Expect(sql).To(ContainSubstring("SEEDEDRAND('media_file2', media_file.id)"))
})
})
})
})