import { MemoryRouter, Switch, Route } from 'react-router-dom'; import { UserLink } from '../UserInfo'; import renderer from 'react-test-renderer'; test('UserLink renders correctly', async () => { const component = renderer.create( <MemoryRouter> <> <UserLink user={{ uid: 1, uname: 'ugnich', avatar: 'https://juick.com/i/a/1-deadbeef.png' }} /> <UserLink user={{ uid: 1, uname: 'ugnich', avatar: 'https://juick.com/i/a/1-deadbeef.png', uri: '' }} /> <UserLink user={{ uid: 0, uname: '', uri: 'https://example.com/u/test' }} /> </> </MemoryRouter> ); await Promise.resolve(); let tree = component.toJSON(); expect(tree).toMatchSnapshot(); });