Another big refactor: Back to a single folder for persistence implementation

This commit is contained in:
Deluan
2020-01-14 18:23:29 -05:00
parent 08e096c569
commit a99c3a8af3
27 changed files with 177 additions and 171 deletions
+30
View File
@@ -0,0 +1,30 @@
package persistence
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() {
repo = NewPropertyRepository()
repo.(*propertyRepository).DeleteAll()
})
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"))
})
})