mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-07 06:27:36 +03:00
SQL/Orm PropertyRepository complete
This commit is contained in:
parent
3d706e3e98
commit
5d519dcecf
5 changed files with 88 additions and 2 deletions
30
persistence/db_sql/property_repository_test.go
Normal file
30
persistence/db_sql/property_repository_test.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package db_sql
|
||||
|
||||
import (
|
||||
"github.com/cloudsonic/sonic-server/domain"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("PropertyRepository", func() {
|
||||
var repo domain.PropertyRepository
|
||||
|
||||
BeforeEach(func() {
|
||||
Db().QueryTable("property").Exclude("id", ".PHONY").Delete()
|
||||
repo = NewPropertyRepository()
|
||||
})
|
||||
|
||||
It("saves and retrieves data", func() {
|
||||
Expect(repo.Put("1", "test")).To(BeNil())
|
||||
Expect(repo.Get("1")).To(Equal("test"))
|
||||
})
|
||||
|
||||
It("returns default if data is not found", func() {
|
||||
Expect(repo.DefaultGet("2", "default")).To(Equal("default"))
|
||||
})
|
||||
|
||||
It("returns value if found", func() {
|
||||
Expect(repo.Put("3", "test")).To(BeNil())
|
||||
Expect(repo.DefaultGet("3", "default")).To(Equal("test"))
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue