1 import React from 'react';
2 import { mount } from 'enzyme';
3 import {Provider} from 'react-redux'
4 import configureStore from 'redux-mock-store';
6 import GlobalInlineMessageBar from 'app/globalInlineMessageBar/GlobalInlineMessageBar.jsx'
9 } from 'utils/GlobalConstants.js'
10 import InlineMessage from 'generic-components/InlineMessage/InlineMessage.jsx';
12 describe('GlobalInlineMessageBarTests', () => {
13 const errMsg = 'some random message';
14 const initialState = {
15 globalInlineMessageBar: {
16 feedbackMsgText: errMsg,
17 feedbackMsgSeverity: MESSAGE_LEVEL_WARNING
20 const mockStore = configureStore();
24 store = mockStore(initialState);
25 wrapper = mount(<Provider store={store}><GlobalInlineMessageBar /></Provider>);
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
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