2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017 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 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 import { expect } from 'chai';
24 import NotificationConstants from 'generic-components/notifications/NotificationConstants.js';
25 import reducer from 'generic-components/notifications/NotificationReducer.js';
27 describe("Notification reducer test suite", function() {
28 const initialState = {
34 it("NOTIFY_INFO event", function() {
36 type: NotificationConstants.NOTIFY_INFO,
43 const newState = reducer(initialState, action);
45 expect(newState.type).to.equal('default');
46 expect(newState.title).to.equal('some title');
47 expect(newState.msg).to.equal('some message');
48 expect(newState.timeout).to.equal(1);
51 it("NOTIFY_ERROR event", function() {
53 type: NotificationConstants.NOTIFY_ERROR,
60 const newState = reducer(initialState, action);
62 expect(newState.type).to.equal('error');
63 expect(newState.title).to.equal('some title');
64 expect(newState.msg).to.equal('some message');
65 expect(newState.timeout).to.equal(1);
68 it("NOTIFY_WARNING event", function() {
70 type: NotificationConstants.NOTIFY_WARNING,
77 const newState = reducer(initialState, action);
79 expect(newState.type).to.equal('warning');
80 expect(newState.title).to.equal('some title');
81 expect(newState.msg).to.equal('some message');
82 expect(newState.timeout).to.equal(1);
85 it("NOTIFY_SUCCESS event", function() {
87 type: NotificationConstants.NOTIFY_SUCCESS,
94 const newState = reducer(initialState, action);
96 expect(newState.type).to.equal('success');
97 expect(newState.title).to.equal('some title');
98 expect(newState.msg).to.equal('some message');
99 expect(newState.timeout).to.equal(1);
102 it("NOTIFY_CLOSE event", function() {
104 type: NotificationConstants.NOTIFY_CLOSE
106 const newState = reducer(initialState, action);
108 expect(newState).to.be.null;