2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017-2018 Amdocs
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 import { expect } from 'chai';
22 import NotificationConstants from 'generic-components/notifications/NotificationConstants.js';
23 import reducer from 'generic-components/notifications/NotificationReducer.js';
25 describe("Notification reducer test suite", function() {
26 const initialState = {
32 it("NOTIFY_INFO event", function() {
34 type: NotificationConstants.NOTIFY_INFO,
41 const newState = reducer(initialState, action);
43 expect(newState.type).to.equal('default');
44 expect(newState.title).to.equal('some title');
45 expect(newState.msg).to.equal('some message');
46 expect(newState.timeout).to.equal(1);
49 it("NOTIFY_ERROR event", function() {
51 type: NotificationConstants.NOTIFY_ERROR,
58 const newState = reducer(initialState, action);
60 expect(newState.type).to.equal('error');
61 expect(newState.title).to.equal('some title');
62 expect(newState.msg).to.equal('some message');
63 expect(newState.timeout).to.equal(1);
66 it("NOTIFY_WARNING event", function() {
68 type: NotificationConstants.NOTIFY_WARNING,
75 const newState = reducer(initialState, action);
77 expect(newState.type).to.equal('warning');
78 expect(newState.title).to.equal('some title');
79 expect(newState.msg).to.equal('some message');
80 expect(newState.timeout).to.equal(1);
83 it("NOTIFY_SUCCESS event", function() {
85 type: NotificationConstants.NOTIFY_SUCCESS,
92 const newState = reducer(initialState, action);
94 expect(newState.type).to.equal('success');
95 expect(newState.title).to.equal('some title');
96 expect(newState.msg).to.equal('some message');
97 expect(newState.timeout).to.equal(1);
100 it("NOTIFY_CLOSE event", function() {
102 type: NotificationConstants.NOTIFY_CLOSE
104 const newState = reducer(initialState, action);
106 expect(newState).to.be.null;