This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
error_message.test.jsx
96 lines (75 loc) · 2.86 KB
/
error_message.test.jsx
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {shallow} from 'enzyme';
import {ErrorPageTypes} from 'utils/constants.jsx';
import ErrorMessage from 'components/error_page/error_message.jsx';
describe('components/error_page/ErrorMessage', () => {
const baseProps = {
type: ErrorPageTypes.LOCAL_STORAGE,
message: '',
service: '',
};
test('should match snapshot, local_storage type', () => {
const wrapper = shallow(
<ErrorMessage {...baseProps}/>
);
expect(wrapper).toMatchSnapshot();
});
test('should match snapshot, permalink_not_found type', () => {
const props = {...baseProps, type: ErrorPageTypes.PERMALINK_NOT_FOUND};
const wrapper = shallow(
<ErrorMessage {...props}/>
);
expect(wrapper).toMatchSnapshot();
});
test('should match snapshot, oauth_missing_code type', () => {
const props = {...baseProps, type: ErrorPageTypes.OAUTH_MISSING_CODE, service: 'Gitlab'};
const wrapper = shallow(
<ErrorMessage {...props}/>
);
expect(wrapper).toMatchSnapshot();
});
test('should match snapshot, oauth_access_denied type', () => {
const props = {...baseProps, type: ErrorPageTypes.OAUTH_ACCESS_DENIED, service: 'Gitlab'};
const wrapper = shallow(
<ErrorMessage {...props}/>
);
expect(wrapper).toMatchSnapshot();
});
test('should match snapshot, page_not_found type', () => {
const props = {...baseProps, type: ErrorPageTypes.PAGE_NOT_FOUND};
const wrapper = shallow(
<ErrorMessage {...props}/>
);
expect(wrapper).toMatchSnapshot();
});
test('should match snapshot, team_not_found type', () => {
const props = {...baseProps, type: ErrorPageTypes.TEAM_NOT_FOUND};
const wrapper = shallow(
<ErrorMessage {...props}/>
);
expect(wrapper).toMatchSnapshot();
});
test('should match snapshot, channel_not_found type', () => {
const props = {...baseProps, type: ErrorPageTypes.CHANNEL_NOT_FOUND};
const wrapper = shallow(
<ErrorMessage {...props}/>
);
expect(wrapper).toMatchSnapshot();
});
test('should match snapshot, no type but with message', () => {
const props = {...baseProps, type: '', message: 'error message'};
const wrapper = shallow(
<ErrorMessage {...props}/>
);
expect(wrapper).toMatchSnapshot();
});
test('should match snapshot, no type nor message', () => {
const props = {...baseProps, type: '', message: ''};
const wrapper = shallow(
<ErrorMessage {...props}/>
);
expect(wrapper).toMatchSnapshot();
});
});