Chore/testing library

This commit is contained in:
Sofiya Tepikin
2022-09-18 10:32:10 +00:00
parent 3c7cb3dfff
commit 7dd1a297a2
8 changed files with 161 additions and 10 deletions
+21
View File
@@ -0,0 +1,21 @@
import React from 'react'
import { render, screen } from '@testing-library/react-native'
import License from '../components/License'
jest.mock('../local-storage', () => ({ saveLicenseFlag: jest.fn() }))
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 })
})
})
+10
View File
@@ -0,0 +1,10 @@
import * as React from 'react'
import { render, screen } from '@testing-library/react-native'
import Logo from '../components/header/logo'
describe('Logo', () => {
test('It works', async () => {
render(<Logo />)
screen.getByText('drip.')
})
})