apollo-mocknetworkinterface
Supports both Apollo 1 & Apollo 2
- Apollo 1: https://github.com/siteone/apollo-mocknetworkinterface/tree/v1.0.0
- Apollo 2: https://github.com/siteone/apollo-mocknetworkinterface/tree/v2.0.0
Installation
To install the stable version:
npm install --save apollo-mocknetworkinterface@^1.0
What is the purpose of the package?
Please read https://medium.com/p/ef0bbd17e686
Example
;;;;; const TestComponent = { if propsdataloading return <div>loading ... JSON</div>; return <div>got data ... JSON</div>;};const TestComponentWithApollo = TestComponent; const createResponse = { // pure function returning data console; // eslint-disable-line no-console // will log: creating mocked response for request: { query: { kind: 'Document' ... return data: component: id: 1 name: 'foo' ;};const mockedNetworkFetch = ; // you can simulate network latencyconst client = link: cache: ;