-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.test.js
41 lines (36 loc) Β· 1.06 KB
/
App.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import 'react-native';
import React from 'react';
import App from './App';
import {create} from 'react-test-renderer';
import Header from './src/components/Header';
import Footer from './src/components/Footer';
jest.runAllTimers();
describe('test for App', () => {
test('Test Rendering', () => {
const tree = create(<App />)
expect(tree).toMatchSnapshot();
})
})
describe('test for Header', () => {
test('Test Rendering', () => {
const header = create(<Header/>)
expect(header).toMatchSnapshot();
})
})
describe('test for Footer', () => {
test('Test Rendering', () => {
const footer = create(<Footer/>)
expect(footer).toMatchSnapshot();
})
})
describe('test for Footers Home icon', () => {
const navigation = {
navigate: jest.fn()
}
const tree = create(<Footer navigation={navigation} />)
test('navigate to home', () => {
const button = tree.root.findByProps({testID: 'home'}).props;
button.onPress();
expect(navigation.navigate).toBeCalledWith('Home');
})
})