
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
apollo-mocknetworkinterface
Advanced tools
Network interface for mocking. See README.md for more information.
Supports both Apollo 1 & Apollo 2
To install the stable version:
npm install --save apollo-mocknetworkinterface@^1.0
Please read https://medium.com/p/ef0bbd17e686
import React from 'react';
import { ApolloClient, ApolloProvider, graphql } from 'react-apollo';
import renderer from 'react-test-renderer';
import MockNetworkInterface from 'apollo-mocknetworkinterface';
import query from './query.graphql';
const TestComponent = (props) => {
if (props.data.loading) {
return (<div>loading ... {JSON.stringify(props)}</div>);
}
return (<div>got data ... {JSON.stringify(props)}</div>);
};
const TestComponentWithApollo = graphql(query, {
options: props => ({
variables: { url: props.url },
}),
})(TestComponent);
const createResponse = (request) => { // pure function returning data
console.log('creating mocked response for request:', request); // eslint-disable-line no-console
// will log: creating mocked response for request: { query: { kind: 'Document' ...
return {
data: {
component: {
id: 1,
name: 'foo',
},
},
};
};
const mockedNetworkFetch = createMockedNetworkFetch(createResponse, { timeout: 100 }); // you can simulate network latency
const client = new ApolloClient({
link: createHttpLink({ uri: 'http://localhost:3000', fetch: mockedNetworkFetch }),
cache: new InMemoryCache(),
});
it('should render without exploding', (done) => {
const component = renderer.create((
<ApolloProvider client={client}>
<div>
<TestComponentWithApollo />
</div>
</ApolloProvider>
));
})
FAQs
Network interface for mocking. See README.md for more information.
The npm package apollo-mocknetworkinterface receives a total of 117 weekly downloads. As such, apollo-mocknetworkinterface popularity was classified as not popular.
We found that apollo-mocknetworkinterface demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.