navidrome/persistence/property_repository_test.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
813 B
Go
Raw Normal View History

package persistence
2020-01-13 03:46:40 +01:00
import (
"context"
"github.com/navidrome/navidrome/log"
2020-01-24 01:44:08 +01:00
"github.com/navidrome/navidrome/model"
2022-07-26 22:47:16 +02:00
. "github.com/onsi/ginkgo/v2"
2020-01-13 03:46:40 +01:00
. "github.com/onsi/gomega"
)
var _ = Describe("Property Repository", func() {
var pr model.PropertyRepository
2020-01-13 03:46:40 +01:00
BeforeEach(func() {
pr = NewPropertyRepository(log.NewContext(context.TODO()), getDBXBuilder())
2020-01-13 03:46:40 +01:00
})
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"))
2020-01-13 03:46:40 +01:00
})
It("updates a property", func() {
Expect(pr.Put("1", "another_value")).To(BeNil())
Expect(pr.Get("1")).To(Equal("another_value"))
2020-01-13 03:46:40 +01:00
})
It("returns a default value if property does not exist", func() {
Expect(pr.DefaultGet("2", "default")).To(Equal("default"))
2020-01-13 03:46:40 +01:00
})
})