【发布时间】:2018-03-02 23:37:50
【问题描述】:
我正在编写一个使用 vue-apollo 与 graphql 交互的 Vue 应用程序。我想知道是否可以存根 graphql 请求。我认为这应该可行:
it('should access a story', function() {
cy.server();
cy.route('http://localhost:3002/graphql', {
data: {
Story: { id: 2, title: 'story title', content: 'story content' }
}
});
cy.visit('/stories/2');
});
不幸的是,我从 graphql 收到一个错误,抱怨 id 是 Int 而不是 ObjectId。我错过了什么吗?
【问题讨论】: