mirror of
https://github.com/navidrome/navidrome.git
synced 2024-09-11 20:12:54 +02:00
36 lines
839 B
Go
36 lines
839 B
Go
package persistence
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/astaxie/beego/orm"
|
|
"github.com/navidrome/navidrome/log"
|
|
"github.com/navidrome/navidrome/model"
|
|
. "github.com/onsi/ginkgo"
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
var _ = Describe("Property Repository", func() {
|
|
var pr model.PropertyRepository
|
|
|
|
BeforeEach(func() {
|
|
pr = NewPropertyRepository(log.NewContext(context.TODO()), orm.NewOrm())
|
|
})
|
|
|
|
It("saves and restore a new property", func() {
|
|
id := "1"
|
|
value := "a_value"
|
|
Expect(pr.Put(id, value)).To(BeNil())
|
|
Expect(pr.Get(id)).To(Equal("a_value"))
|
|
})
|
|
|
|
It("updates a property", func() {
|
|
Expect(pr.Put("1", "another_value")).To(BeNil())
|
|
Expect(pr.Get("1")).To(Equal("another_value"))
|
|
})
|
|
|
|
It("returns a default value if property does not exist", func() {
|
|
Expect(pr.DefaultGet("2", "default")).To(Equal("default"))
|
|
})
|
|
})
|