forked from rafaelmotta/react-native-scl-alert
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSCLAlertTitle.test.js
47 lines (40 loc) · 949 Bytes
/
SCLAlertTitle.test.js
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
import { SCLAlertTitle } from '../src/components'
import { View, Text } from 'react-native'
describe('<SCLAlertTitle />', () => {
const props = {
title: 'Lorem',
titleContainerStyle: {
marginTop: 10,
},
titleStyle: {
fontSize: 14,
},
}
let wrapper
beforeEach(() => {
wrapper = shallow(<SCLAlertTitle {...props} />)
})
it('renders correctly', () => {
expect(wrapper.length).toBe(1)
expect(wrapper).toMatchSnapshot()
})
it('renders the label correctly', () => {
expect(wrapper.find(Text).contains(props.title)).toBe(true)
})
it('renders the titleContainerStyle', () => {
expect(
wrapper
.find(View)
.first()
.props().style[1],
).toEqual(props.titleContainerStyle)
})
it('renders the titleStyle', () => {
expect(
wrapper
.find(Text)
.first()
.props().style[1],
).toEqual(props.titleStyle)
})
})