forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_menu_mobile.test.tsx
58 lines (51 loc) · 1.66 KB
/
dot_menu_mobile.test.tsx
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
51
52
53
54
55
56
57
58
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {shallow, ShallowWrapper} from 'enzyme';
import React from 'react';
import DotMenu from 'components/dot_menu/dot_menu';
import {TestHelper} from 'utils/test_helper';
jest.mock('utils/utils', () => {
return {
isMobile: jest.fn(() => true),
localizeMessage: jest.fn(),
};
});
jest.mock('utils/post_utils', () => {
const original = jest.requireActual('utils/post_utils');
return {
...original,
isSystemMessage: jest.fn(() => true),
};
});
describe('components/dot_menu/DotMenu on mobile view', () => {
test('should match snapshot', () => {
const baseProps = {
post: TestHelper.getPostMock({id: 'post_id_1'}),
isLicensed: false,
postEditTimeLimit: '-1',
enableEmojiPicker: true,
components: {},
channelIsArchived: false,
currentTeamUrl: '',
actions: {
flagPost: jest.fn(),
unflagPost: jest.fn(),
setEditingPost: jest.fn(),
pinPost: jest.fn(),
unpinPost: jest.fn(),
openModal: jest.fn(),
markPostAsUnread: jest.fn(),
doAppCall: jest.fn(),
},
canEdit: false,
canDelete: false,
appBindings: [],
pluginMenuItems: [],
appsEnabled: false,
};
const wrapper: ShallowWrapper<any, any, DotMenu> = shallow(
<DotMenu {...baseProps}/>,
);
expect(wrapper).toMatchSnapshot();
});
});