Add tests for AppHelp component
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { render } from '@testing-library/react-native'
|
||||||
|
import AppHelp from '../../../components/common/AppHelp'
|
||||||
|
|
||||||
|
jest.mock('react-i18next', () => ({
|
||||||
|
useTranslation: () => ({
|
||||||
|
t: (str, options) => {
|
||||||
|
return str + (options ? JSON.stringify(options) : '')
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
}))
|
||||||
|
|
||||||
|
describe('AppHelp screen', () => {
|
||||||
|
test('when provided text, should render it', async () => {
|
||||||
|
const text = 'Some help test'
|
||||||
|
const { toJSON } = render(<AppHelp text={text} />)
|
||||||
|
|
||||||
|
expect(toJSON()).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`AppHelp screen when provided text, should render it 1`] = `
|
||||||
|
<View
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"alignItems": "center",
|
||||||
|
"flexDirection": "row",
|
||||||
|
"justifyContent": "space-between",
|
||||||
|
"padding": 34.285714285714285,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Text
|
||||||
|
style={
|
||||||
|
Array [
|
||||||
|
Object {
|
||||||
|
"color": "#555",
|
||||||
|
"fontFamily": "Jost-Book",
|
||||||
|
"fontSize": 34.285714285714285,
|
||||||
|
},
|
||||||
|
Object {
|
||||||
|
"alignSelf": "flex-start",
|
||||||
|
"color": "#3A2671",
|
||||||
|
"fontFamily": "Jost-Bold",
|
||||||
|
"fontSize": 27.857142857142858,
|
||||||
|
"paddingRight": 34.285714285714285,
|
||||||
|
"textAlignVertical": "center",
|
||||||
|
"textTransform": "uppercase",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
>
|
||||||
|
*
|
||||||
|
</Text>
|
||||||
|
<Text
|
||||||
|
style={
|
||||||
|
Array [
|
||||||
|
Object {
|
||||||
|
"color": "#555",
|
||||||
|
"fontFamily": "Jost-Book",
|
||||||
|
"fontSize": 34.285714285714285,
|
||||||
|
},
|
||||||
|
undefined,
|
||||||
|
]
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Some help test
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
`;
|
||||||
Reference in New Issue
Block a user