@@ -155,6 +155,9 @@ func TestSchemaSubscribe(t *testing.T) {
155
155
{
156
156
"field" : "bye" ,
157
157
},
158
+ {
159
+ "field" : nil ,
160
+ },
158
161
}),
159
162
},
160
163
},
@@ -169,6 +172,7 @@ func TestSchemaSubscribe(t *testing.T) {
169
172
ExpectedResults : []testutil.TestResponse {
170
173
{Data : `{ "sub_with_object": { "field": "hello" } }` },
171
174
{Data : `{ "sub_with_object": { "field": "bye" } }` },
175
+ {Data : `{ "sub_with_object": { "field": null } }` },
172
176
},
173
177
},
174
178
@@ -196,60 +200,28 @@ func TestSchemaSubscribe(t *testing.T) {
196
200
},
197
201
},
198
202
},
199
- // {
200
- // Name: "subscription_resolver_can_error_optional_msg",
201
- // Schema: schema,
202
- // Query: `
203
- // subscription onHelloSaid {
204
- // helloSaidNullable {
205
- // msg
206
- // }
207
- // }
208
- // `,
209
- // ExpectedResults: []testutil.TestResponse{
210
- // {
211
- // Data: json.RawMessage(`
212
- // {
213
- // "helloSaidNullable": {
214
- // "msg": null
215
- // }
216
- // }
217
- // `),
218
- // Errors: []gqlerrors.FormattedError{{Message: ""}}},
219
- // },
220
- // },
221
- // {
222
- // Name: "subscription_resolver_can_error_optional_event",
223
- // Schema: schema,
224
- // Query: `
225
- // subscription onHelloSaid {
226
- // helloSaidNullable {
227
- // msg
228
- // }
229
- // }
230
- // `,
231
- // ExpectedResults: []testutil.TestResponse{
232
- // {
233
- // Data: json.RawMessage(`
234
- // {
235
- // "helloSaidNullable": null
236
- // }
237
- // `),
238
- // Errors: []gqlerrors.FormattedError{{Message: ""}}},
239
- // },
240
- // },
241
- // {
242
- // Name: "schema_without_resolver_errors",
243
- // Schema: schema,
244
- // Query: `
245
- // subscription onHelloSaid {
246
- // helloSaid {
247
- // msg
248
- // }
249
- // }
250
- // `,
251
- // ExpectedErr: errors.New("schema created without resolver, can not subscribe"),
252
- // },
203
+
204
+ {
205
+ Name : "schema_without_subscribe_errors" ,
206
+ Schema : makeSubscriptionSchema (t , graphql.ObjectConfig {
207
+ Name : "Subscription" ,
208
+ Fields : graphql.Fields {
209
+ "should_error" : & graphql.Field {
210
+ Type : graphql .String ,
211
+ },
212
+ },
213
+ }),
214
+ Query : `
215
+ subscription {
216
+ should_error
217
+ }
218
+ ` ,
219
+ ExpectedResults : []testutil.TestResponse {
220
+ {
221
+ Errors : []string {"the subscription function \" should_error\" is not defined" },
222
+ },
223
+ },
224
+ },
253
225
})
254
226
}
255
227
0 commit comments