Merge "Adding missing packege"
[aai/sparky-fe.git] / test / app / globalAutoCompleteSearchBar / GlobalAutoCompleteSearchBar.test.js
1 import React from 'react';
2 import { mount } from 'enzyme';
3 import {Provider} from 'react-redux'
4 import configureStore from 'redux-mock-store';
5
6 import GlobalAutoCompleteSearchBar from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBar.jsx'
7 import AutoCompleteSearchBar from 'generic-components/autoCompleteSearchBar/AutoCompleteSearchBar.jsx';
8 import {
9   globalAutoCompleteSearchBarActionTypes
10 } from 'app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarConstants.js';
11
12 describe('GlobalAutoCompleteSearchBarTests', () => {
13   const initValue = 'some random search text';
14   const initialState = {
15     globalAutoCompleteSearchBarReducer: {
16       value: initValue
17     }
18   };
19   const mockStore = configureStore();
20   let store, wrapper;
21
22   beforeEach( () => {
23     store = mockStore(initialState);
24     wrapper = mount(<Provider store={store}><GlobalAutoCompleteSearchBar /></Provider>);
25   })
26
27   it('render search bar - visible', () => {
28     expect(wrapper).toHaveLength(1); // ensure the message bar is mounted
29     expect(wrapper.find(AutoCompleteSearchBar)).toHaveLength(1); // ensure the InlineMessage is mounted
30   });
31
32   it('props assigned properly', () => {
33     expect(wrapper.find(AutoCompleteSearchBar).props().value).toEqual(initValue); // check that the props match
34   })
35 })