-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.test.js
30 lines (25 loc) · 870 Bytes
/
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
import React from 'react'
import '@testing-library/jest-dom'
import { render } from '@testing-library/react'
import { Provider } from 'react-redux'
import configureStore from 'redux-mock-store'
import { initialStateTestData } from '../../test-data'
import App from './App'
describe('App', () => {
let AppComponent, store, mockStore, initialState, restaurant
beforeEach(() => {
initialState = initialStateTestData
restaurant = initialStateTestData.restaurants[0]
mockStore = configureStore()
store = mockStore(initialState)
AppComponent = render(
<Provider store={store}>
<App />
</Provider>,
)
})
it('App should successfully render Layout ( Layouts render Header, Footer and Children components )', () => {
const { getByText } = AppComponent
expect(getByText(restaurant.name)).toBeInTheDocument()
})
})