@@ -54,11 +54,36 @@ Feature: GraphQL mutation support
54
54
And the JSON node "data.createFoo.bar" should be equal to "new"
55
55
And the JSON node "data.createFoo.clientMutationId" should be equal to "myId"
56
56
57
+ Scenario : Create an item with a subresource
58
+ Given there are 1 dummy objects with relatedDummy
59
+ When I send the following GraphQL request:
60
+ """
61
+ mutation {
62
+ createDummy(input: {_id: 1, name: "A dummy", foo: [], relatedDummy: "/related_dummies/1", clientMutationId: "myId"}) {
63
+ id
64
+ name
65
+ foo
66
+ relatedDummy {
67
+ name
68
+ }
69
+ clientMutationId
70
+ }
71
+ }
72
+ """
73
+ Then the response status code should be 200
74
+ And the response should be in JSON
75
+ And the header "Content-Type" should be equal to "application/json"
76
+ And the JSON node "data.createDummy.id" should be equal to "/dummies/2"
77
+ And the JSON node "data.createDummy.name" should be equal to "A dummy"
78
+ And the JSON node "data.createDummy.foo" should have 0 elements
79
+ And the JSON node "data.createDummy.relatedDummy.name" should be equal to "RelatedDummy #1"
80
+ And the JSON node "data.createDummy.clientMutationId" should be equal to "myId"
81
+
57
82
Scenario : Create an item with an iterable field
58
83
When I send the following GraphQL request:
59
84
"""
60
85
mutation {
61
- createDummy(input: {_id: 1 , name: "A dummy", foo: [], jsonData: {bar:{baz:3,qux:[7.6,false,null]}}, clientMutationId: "myId"}) {
86
+ createDummy(input: {_id: 2 , name: "A dummy", foo: [], jsonData: {bar:{baz:3,qux:[7.6,false,null]}}, clientMutationId: "myId"}) {
62
87
id
63
88
name
64
89
foo
@@ -70,7 +95,7 @@ Feature: GraphQL mutation support
70
95
Then the response status code should be 200
71
96
And the response should be in JSON
72
97
And the header "Content-Type" should be equal to "application/json"
73
- And the JSON node "data.createDummy.id" should be equal to "/dummies/1 "
98
+ And the JSON node "data.createDummy.id" should be equal to "/dummies/3 "
74
99
And the JSON node "data.createDummy.name" should be equal to "A dummy"
75
100
And the JSON node "data.createDummy.foo" should have 0 elements
76
101
And the JSON node "data.createDummy.jsonData.bar.baz" should be equal to the number 3
0 commit comments