Add tests to Inventory module
[aai/sparky-fe.git] / test / 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 })

© 2017 ONAP. Copyright © The Linux Foundation ®. All Rights Reserved.
The Linux Foundation has registered trademarks and uses trademarks.
For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.
Linux is a registered trademark of Linus Torvalds.
Privacy Policy and Terms of Use