-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dropdown.test.js
39 lines (31 loc) · 1.06 KB
/
Dropdown.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
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 Dropdown from './Dropdown'
describe('Dropdown', () => {
let DropdownComponent, store, mockStore, initialState
beforeEach(() => {
initialState = initialStateTestData
mockStore = configureStore()
store = mockStore(initialState)
DropdownComponent = render(
<Provider store={store}>
<Dropdown
possibleOptions={initialState.restaurants[0].genreArray}
title='Filter by Genre'
/>
</Provider>,
)
})
it('Dropdown should successfully display given options', () => {
const { getByText } = DropdownComponent
expect(getByText('DISPLAY ALL')).toBeInTheDocument()
expect(getByText('Filter by Genre')).toBeInTheDocument()
for (const genre of initialState.restaurants[0].genreArray) {
expect(getByText(genre)).toBeInTheDocument()
}
})
})