summaryrefslogtreecommitdiffstats
path: root/webapp/tests/plugins/pluggable.test.jsx
blob: 96dedb037c35b01fcef0ee014ed1f2ff8e3cbca4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

import React from 'react';
import {mount} from 'enzyme';
import {IntlProvider} from 'react-intl';

import Pluggable from 'plugins/pluggable/pluggable.jsx';
import ProfilePopover from 'components/profile_popover.jsx';

class ProfilePopoverPlugin extends React.PureComponent {
    render() {
        return <span>{'ProfilePopoverPlugin'}</span>;
    }
}

describe('plugins/Pluggable', () => {
    test('should match snapshot with overridden component', () => {
        const wrapper = mount(
            <Pluggable
                components={{ProfilePopover: ProfilePopoverPlugin}}
                theme={{}}
            >
                <ProfilePopover
                    user={{}}
                    src='src'
                />
            </Pluggable>
        );
        expect(wrapper).toMatchSnapshot();
    });

    test('should match snapshot with no overridden component', () => {
        window.mm_config = {};
        const wrapper = mount(
            <IntlProvider>
                <Pluggable
                    components={{}}
                    theme={{}}
                >
                    <ProfilePopover
                        user={{}}
                        src='src'
                    />
                </Pluggable>
            </IntlProvider>
        );
        expect(wrapper).toMatchSnapshot();
    });
});