619 Create test utils for react testing library

This commit is contained in:
Lisa
2022-10-19 13:17:19 +00:00
committed by Sofiya Tepikin
parent 9dfe8b4b05
commit 1b5ffaf5d6
9 changed files with 468 additions and 427 deletions
+3 -11
View File
@@ -1,24 +1,16 @@
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) : '')
},
}),
}))
import { render, screen } from './test-utils'
describe('License screen', () => {
test('It should have a correct year', async () => {
test('should display license text with correct year', async () => {
render(<License />)
const year = new Date().getFullYear().toString()
screen.getByText(year, { exact: false })
})
test('It should match the snapshot', async () => {
test('should match the snapshot', async () => {
const licenseScreen = render(<License />)
expect(licenseScreen).toMatchSnapshot()