forked from sbstjn/appsync-resolvers
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinvocation_test.go
44 lines (36 loc) · 892 Bytes
/
invocation_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
43
44
package resolvers
import (
"encoding/json"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Invocation", func() {
Context("With Arguments", func() {
data := invocation{
Resolve: "exaple.resolver",
Context: appsyncContext{
Arguments: json.RawMessage(`{ "foo": "bar" }`),
},
}
It("should be root", func() {
Expect(data.isRoot()).To(BeTrue())
})
It("should detect data", func() {
Expect(data.payload()).To(Equal(json.RawMessage(`{ "foo": "bar" }`)))
})
})
Context("With Source", func() {
data := invocation{
Resolve: "exaple.resolver",
Context: appsyncContext{
Source: json.RawMessage(`{ "bar": "foo" }`),
},
}
It("should be root", func() {
Expect(data.isRoot()).To(BeFalse())
})
It("should detect data", func() {
Expect(data.payload()).To(Equal(json.RawMessage(`{ "bar": "foo" }`)))
})
})
})