2 * ============LICENSE_START=======================================================
3 * SPARKY (AAI UI service)
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property.
6 * Copyright © 2017 Amdocs
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
22 * ECOMP and OpenECOMP are trademarks
23 * and service marks of AT&T Intellectual Property.
26 import { expect } from 'chai';
27 import NotificationConstants from 'generic-components/notifications/NotificationConstants.js';
28 import reducer from 'generic-components/notifications/NotificationReducer.js';
30 describe("Notification reducer test suite", function() {
31 const initialState = {
37 it("NOTIFY_INFO event", function() {
39 type: NotificationConstants.NOTIFY_INFO,
46 const newState = reducer(initialState, action);
48 expect(newState.type).to.equal('default');
49 expect(newState.title).to.equal('some title');
50 expect(newState.msg).to.equal('some message');
51 expect(newState.timeout).to.equal(1);
54 it("NOTIFY_ERROR event", function() {
56 type: NotificationConstants.NOTIFY_ERROR,
63 const newState = reducer(initialState, action);
65 expect(newState.type).to.equal('error');
66 expect(newState.title).to.equal('some title');
67 expect(newState.msg).to.equal('some message');
68 expect(newState.timeout).to.equal(1);
71 it("NOTIFY_WARNING event", function() {
73 type: NotificationConstants.NOTIFY_WARNING,
80 const newState = reducer(initialState, action);
82 expect(newState.type).to.equal('warning');
83 expect(newState.title).to.equal('some title');
84 expect(newState.msg).to.equal('some message');
85 expect(newState.timeout).to.equal(1);
88 it("NOTIFY_SUCCESS event", function() {
90 type: NotificationConstants.NOTIFY_SUCCESS,
97 const newState = reducer(initialState, action);
99 expect(newState.type).to.equal('success');
100 expect(newState.title).to.equal('some title');
101 expect(newState.msg).to.equal('some message');
102 expect(newState.timeout).to.equal(1);
105 it("NOTIFY_CLOSE event", function() {
107 type: NotificationConstants.NOTIFY_CLOSE
109 const newState = reducer(initialState, action);
111 expect(newState).to.be.null;