Add app test
This commit is contained in:
parent
08f91bf531
commit
e432c1b711
10
jestSetup.ts
10
jestSetup.ts
|
@ -14,8 +14,8 @@ jest.mock('react-native-share', () => jest.fn())
|
||||||
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper')
|
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper')
|
||||||
jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter')
|
jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter')
|
||||||
|
|
||||||
//jest.mock('react-native-reanimated', () => {
|
jest.mock('react-native-reanimated', () => {
|
||||||
// const Reanimated = require('react-native-reanimated/mock')
|
const Reanimated = require('react-native-reanimated/mock')
|
||||||
// Reanimated.default.call = () => {}
|
Reanimated.default.call = () => {}
|
||||||
// return Reanimated
|
return Reanimated
|
||||||
//})
|
})
|
||||||
|
|
24
tests/App.test.tsx
Normal file
24
tests/App.test.tsx
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
import React from 'react'
|
||||||
|
import 'react-native'
|
||||||
|
import {render, waitFor} from 'react-native-testing-library'
|
||||||
|
import App from '../App'
|
||||||
|
import Settings from '../settings'
|
||||||
|
|
||||||
|
jest.mock('../db.ts', () => ({
|
||||||
|
settingsRepo: {
|
||||||
|
findOne: () => Promise.resolve({} as Settings),
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
|
jest.mock('../data-source.ts', () => ({
|
||||||
|
AppDataSource: {
|
||||||
|
isInitialized: false,
|
||||||
|
initialize: jest.fn(),
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
|
||||||
|
it('renders correctly', async () => {
|
||||||
|
const {getAllByText} = render(<App />)
|
||||||
|
const title = await waitFor(() => getAllByText('Home'))
|
||||||
|
expect(title.length).toBeGreaterThan(0)
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user