-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconnor_test.go
42 lines (32 loc) · 1.05 KB
/
connor_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package connor_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/SierraSoftworks/connor"
)
var _ = Describe("Connor", func() {
Describe("with a malformed operator", func() {
_, err := MatchWith("malformed", nil, nil)
It("should return an error", func() {
Expect(err).ToNot(BeNil())
})
It("should provide a descriptive error", func() {
Expect(err.Error()).To(Equal("operator should have '$' prefix"))
})
It("should return a short error", func() {
Expect(len(err.Error()) < 80).To(BeTrue(), "error message should be less than 80 characters long")
})
})
Describe("with an invalid/unknown operator", func() {
_, err := MatchWith("$invalid", nil, nil)
It("should return an error", func() {
Expect(err).ToNot(BeNil())
})
It("should provide a descriptive error", func() {
Expect(err.Error()).To(Equal("unknown operator 'invalid'"))
})
It("should return a short error", func() {
Expect(len(err.Error()) < 80).To(BeTrue(), "error message should be less than 80 characters long")
})
})
})