如何为graphql编写单元测试.我正在使用apollo服务器,graphql-tester和graphql.
当我运行测试时,它会出现以下错误
{ raw: '{"errors":[{"message":"Cannot read property \'definitions\' of undefined"}]}',
data: undefined,
errors: [ { message: 'Cannot read property \'definitions\' of undefined' } ],
headers:
{ 'x-powered-by': 'Express',
'content-type': 'application/json',
date: 'Wed, 18 Jan 2017 05:56:22 GMT',
connection: 'close',
'transfer-encoding': 'chunked' },
status: 400,
success: false }
1) Returns success
0 passing (35ms)
1 failing
1) Unittest1 Returns success:
TypeError: Cannot read property 'success' of undefined
at Assertion. (node_modules/chai/lib/chai/core/assertions.js:890:14)
at Assertion.ctx.(anonymous function) (node_modules/chai/lib/chai/utils/addMethod.js:41:25)
at Assertion.somethingMethod (node_modules/chai-things/lib/chai-things.js:97:25)
at Assertion.ctx.(anonymous function) (node_modules/chai/lib/chai/utils/overwriteMethod.js:49:33) …