blob: 30c359289eda03139dc98639f70db428584df058 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
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();
});
|