Merge "Adding missing packege"
[aai/sparky-fe.git] / test / app / globalInlineMessageBar / GlobalInlineMessageBar.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 GlobalInlineMessageBar from 'app/globalInlineMessageBar/GlobalInlineMessageBar.jsx'
7 import {
8   MESSAGE_LEVEL_WARNING
9 } from 'utils/GlobalConstants.js'
10 import InlineMessage from 'generic-components/InlineMessage/InlineMessage.jsx';
11
12 describe('GlobalInlineMessageBarTests', () => {
13   const errMsg = 'some random message';
14   const initialState = {
15     globalInlineMessageBar: {
16       feedbackMsgText: errMsg,
17       feedbackMsgSeverity: MESSAGE_LEVEL_WARNING
18     }
19   };
20   const mockStore = configureStore();
21   let store, wrapper;
22
23   beforeEach( () => {
24     store = mockStore(initialState);
25     wrapper = mount(<Provider store={store}><GlobalInlineMessageBar /></Provider>);
26   })
27
28   it('render message bar - visible', () => {
29     expect(wrapper).toHaveLength(1); // ensure the message bar is mounted
30     expect(wrapper.find(InlineMessage)).toHaveLength(1); // ensure the InlineMessage is mounted
31   });
32
33   it('props assigned properly', () => {
34     expect(wrapper.find(InlineMessage).props().level).toEqual(MESSAGE_LEVEL_WARNING); // check that the props match
35     expect(wrapper.find(InlineMessage).props().messageTxt).toEqual(errMsg); // check that the props match
36   })
37 })