Skip to content

Instantly share code, notes, and snippets.

@ericdcobb
Created February 12, 2020 23:58
Show Gist options
  • Save ericdcobb/e68fefdb30ff3e8acd18edc33254d2ab to your computer and use it in GitHub Desktop.
Save ericdcobb/e68fefdb30ff3e8acd18edc33254d2ab to your computer and use it in GitHub Desktop.
import React from 'react';
import { render } from '@testing-library/react';
import App from './App';
jest.mock('./MyComponent', () => () => {
React.useEffect(() => {
console.log('using an effect');
});
return (<div>Hello World</div>);
});
test('renders', () => {
const { container } = render(<App/>);
expect(container.textContent)
.toMatch('Hello World');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment