【发布时间】:2019-06-22 17:01:57
【问题描述】:
我编写了以下节点客户端,它与 graphql 服务器交互并使用 apollo-tools 节点模块。我无法在节点中找到以下任何模拟测试。请告诉我有没有办法模拟下面的代码。
const batchIdFetchClient = new ApolloClient({
uri: `http://localhost:3435`,
fetch,
})
await batchfetchclient.query({
query: gql`
query batcidId($batchid: String!) {
batchIds(batchid: $batchid){
batchrenewedId
}
}
`,
variables: {
batchid: 'exdsfsdfsfdid1234', // As of now hardcoded
},
})
.then(data => {
logger.info('BatchId Database Successful Response =>' + JSON.stringify(data))
})
.catch(error => {
logger.error('BatchId Database Error Response =>' + error)
})
【问题讨论】:
标签: node.js apollo react-apollo apollo-client apollo-server