quintodrome/persistence/helpers_test.go

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

20 lines
473 B
Go
Raw Normal View History

2020-03-25 16:33:32 -08:00
package persistence
import (
"github.com/Masterminds/squirrel"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Helpers", func() {
Describe("Exists", func() {
It("constructs the correct EXISTS query", func() {
2020-05-01 05:17:21 -08:00
e := exists("album", squirrel.Eq{"id": 1})
2020-03-25 16:33:32 -08:00
sql, args, err := e.ToSql()
Expect(sql).To(Equal("exists (select 1 from album where id = ?)"))
Expect(args).To(Equal([]interface{}{1}))
Expect(err).To(BeNil())
})
})
})