Skip to content

Commit b55fd04

Browse files
committed
Add a test for a mutation with a subresource
1 parent e87e099 commit b55fd04

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

features/graphql/mutation.feature

+27-2
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,36 @@ Feature: GraphQL mutation support
5454
And the JSON node "data.createFoo.bar" should be equal to "new"
5555
And the JSON node "data.createFoo.clientMutationId" should be equal to "myId"
5656

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+
5782
Scenario: Create an item with an iterable field
5883
When I send the following GraphQL request:
5984
"""
6085
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"}) {
6287
id
6388
name
6489
foo
@@ -70,7 +95,7 @@ Feature: GraphQL mutation support
7095
Then the response status code should be 200
7196
And the response should be in JSON
7297
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"
7499
And the JSON node "data.createDummy.name" should be equal to "A dummy"
75100
And the JSON node "data.createDummy.foo" should have 0 elements
76101
And the JSON node "data.createDummy.jsonData.bar.baz" should be equal to the number 3

0 commit comments

Comments
 (0)