-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSearchbar.test.js
46 lines (41 loc) · 1 KB
/
Searchbar.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
46
import React from 'react';
import ReactDOM from 'react-dom';
import SearchBar from './src/index';
import Enzyme, { shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Enzyme.configure({ adapter: new Adapter() });
it('SearchBar without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(
<SearchBar
onSearch={() => {}}
apiData={{}}
handleDataToRender={() => {}}
styles={{}}
/>,
div
);
ReactDOM.unmountComponentAtNode(div);
});
it('always renders a `input bar`', () => {
const searchbar = shallow(
<SearchBar
onSearch={() => {}}
apiData={{}}
handleDataToRender={() => {}}
styles={{}}
/>
);
expect(searchbar.find('input').length).toBe(1);
});
it('always renders a `button `', () => {
const searchbar = shallow(
<SearchBar
onSearch={() => {}}
apiData={{}}
handleDataToRender={() => {}}
styles={{}}
/>
);
expect(searchbar.find('button').length).toBe(1);
});