File tree Expand file tree Collapse file tree 1 file changed +37
-1
lines changed
src/__tests__/github_issues Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ describe("issue #248 - payloads' errors", () => {
124124 } ) ;
125125 } ) ;
126126
127- it ( 'check validation for createMany' , async ( ) => {
127+ it ( 'check validation for createMany with error in mutation payload ' , async ( ) => {
128128 const res = await graphql . graphql ( {
129129 schema,
130130 source : `
@@ -170,4 +170,40 @@ describe("issue #248 - payloads' errors", () => {
170170 } ,
171171 } ) ;
172172 } ) ;
173+
174+ it ( 'check validation for createMany with root-level errors & extension' , async ( ) => {
175+ const res = await graphql . graphql ( {
176+ schema,
177+ source : `
178+ mutation {
179+ createMany(records: [{ name: "Ok"}, { name: "John", someStrangeField: "Test" }]) {
180+ records {
181+ name
182+ }
183+ }
184+ }
185+ ` ,
186+ } ) ;
187+
188+ expect ( res ) . toEqual ( {
189+ data : { createMany : null } ,
190+ errors : [
191+ expect . objectContaining ( {
192+ message : 'Nothing has been saved. Some documents contain validation errors' ,
193+ extensions : {
194+ name : 'ValidationError' ,
195+ errors : [
196+ {
197+ idx : 1 ,
198+ message : 'this is a validate message' ,
199+ path : 'someStrangeField' ,
200+ value : 'Test' ,
201+ } ,
202+ ] ,
203+ } ,
204+ path : [ 'createMany' ] ,
205+ } ) ,
206+ ] ,
207+ } ) ;
208+ } ) ;
173209} ) ;
You can’t perform that action at this time.
0 commit comments