-
Notifications
You must be signed in to change notification settings - Fork 0
/
Layout.test.js
45 lines (38 loc) · 1.31 KB
/
Layout.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
42
43
44
45
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 Layout from './Layout'
import RestaurantsPage from '../../pages/RestaurantsPage/RestaurantsPage'
describe('Layout', () => {
let LayoutComponent, store, mockStore, initialState, restaurant
beforeEach(() => {
initialState = initialStateTestData
restaurant = initialStateTestData.restaurants[0]
mockStore = configureStore()
store = mockStore(initialState)
LayoutComponent = render(
<Provider store={store}>
<Layout>
<RestaurantsPage />
</Layout>
</Provider>,
)
})
it('Layout should successfully render', () => {
const { getByText } = LayoutComponent
expect(getByText(restaurant.name)).toBeInTheDocument()
})
it('Layout should successfully render Header', () => {
const { getByText } = LayoutComponent
expect(getByText('Restaurants Search Engine')).toBeInTheDocument()
})
it('Layout should successfully render Footer', () => {
const { getByText } = LayoutComponent
expect(
getByText('© Restaurants Search Engine. All rights reserved.'),
).toBeInTheDocument()
})
})