aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui/__tests__/UserLink.test.js
blob: 99ca42ce132998f8f2619c1549d6ecfe05f71bcb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { MemoryRouter } from 'react-router-dom'

import { UserLink } from '../UserInfo'
import renderer, { act } from 'react-test-renderer'

test('UserLink renders correctly', async () => {
    let component = null
    act(() => {
        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>
        )
    })
    let tree = component.toJSON()
    expect(tree).toMatchSnapshot()
})