@@ -65,6 +65,31 @@ describe('NotificationsComponent', () => {
6565 expect ( wrapper . html ( ) ) . to . have . string ( notification . message ) ;
6666 } ) ;
6767
68+ it ( 'should not add notification if it already exists based on the uid' , ( ) => {
69+ const wrapper = mountComponent ( ) ;
70+
71+ wrapper . setProps ( {
72+ notifications : [
73+ { ...notification , uid : 1 , title : '1st' } ,
74+ { ...notification , uid : 2 , title : '2nd' } ,
75+ { ...notification , uid : 3 , title : '3rd' } ,
76+ { ...notification , uid : 1 , title : '4th' } ,
77+ { ...notification , uid : 2 , title : '5th' } ,
78+ { ...notification , uid : 3 , title : '6th' }
79+ ]
80+ } ) ;
81+
82+ const html = wrapper . html ( ) ;
83+
84+ expect ( html ) . to . have . string ( '1st' ) ;
85+ expect ( html ) . to . have . string ( '2nd' ) ;
86+ expect ( html ) . to . have . string ( '3rd' ) ;
87+
88+ expect ( html ) . not . to . have . string ( '4th' ) ;
89+ expect ( html ) . not . to . have . string ( '5th' ) ;
90+ expect ( html ) . not . to . have . string ( '6th' ) ;
91+ } ) ;
92+
6893 it ( 'calls onRemove once the notification is auto dismissed' , ( done ) => {
6994 const wrapper = mountComponent ( ) ;
7095 const onRemove = sinon . spy ( ) ;
0 commit comments