当我尝试从graphql.js获得响应时,我收到错误
{ data: { countries: null },
errors:
[ GraphQLError {
message: 'ConnectionConfig is not a constructor'
]
}
这是我在里面有架构的jest文件。 使用express-graphql server这个查询工作。
const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Countries',
fields() {
return {
countries: {
type: new GraphQLList(Country),
args: {
id: { type: GraphQLString }
},
resolve (root, args) {
return Db.models.country.findAll({ where: args });
}
}
}
}
})
});
it('Country', () => {
const query = `{ countries { id } }`;
graphql(schema, query)
.then(res => {
console.log(res);
})
});