Compare commits

...

1 Commits

Author SHA1 Message Date
Sofiya Tepikin c56b6fe62e Test 2022-09-18 15:21:55 +02:00
2 changed files with 46 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import React from 'react'
import PropTypes from 'prop-types'
import { useTranslation } from 'react-i18next'
import AppPage from '../common/app-page'
import AppText from '../common/app-text'
import Segment from '../common/segment'
const License = ({ children }) => {
const { t } = useTranslation()
const currentYear = new Date().getFullYear()
return (
<AppPage title={t('settings.license.title')}>
<Segment last>
<AppText>{t('settings.license.text', { currentYear })}</AppText>
{children}
</Segment>
</AppPage>
)
}
License.propTypes = {
children: PropTypes.node,
}
export default License
+19
View File
@@ -0,0 +1,19 @@
import React from 'react'
import { render, screen } from '@testing-library/react-native'
import License from '../components/settings/License'
jest.mock('react-i18next', () => ({
useTranslation: () => ({
t: (str, options) => {
return str + (options ? JSON.stringify(options) : '')
},
}),
}))
describe('License screen', () => {
test('It should have a correct year', async () => {
render(<License setLicense={() => {}} />)
const year = new Date().getFullYear().toString()
screen.getByText(year, { exact: false })
})
})