11import { inject , TestBed } from '@angular/core/testing' ;
2+ import { Subject } from 'rxjs' ;
23
34import { NotifierAction } from '../models/notifier-action.model' ;
45import { NotifierConfig } from '../models/notifier-config.model' ;
@@ -170,6 +171,16 @@ describe('Notifier Service', () => {
170171 it ( 'should return the configuration' , ( ) => {
171172 expect ( service . getConfig ( ) ) . toEqual ( testNotifierConfig ) ;
172173 } ) ;
174+
175+ it ( 'should return the notification action' , ( ) => {
176+ const testNotificationId = 'ID_FAKE' ;
177+ const expectedAction : NotifierAction = {
178+ payload : testNotificationId ,
179+ type : 'HIDE' ,
180+ } ;
181+ service . actionStream . subscribe ( ( action ) => expect ( action ) . toEqual ( expectedAction ) ) ;
182+ service . hide ( testNotificationId ) ;
183+ } ) ;
173184} ) ;
174185
175186/**
@@ -180,6 +191,7 @@ class MockNotifierQueueService extends NotifierQueueService {
180191 * Last action
181192 */
182193 public lastAction : NotifierAction ;
194+ public actionStream = new Subject < NotifierAction > ( ) ;
183195
184196 /**
185197 * Push a new action to the queue
@@ -190,5 +202,6 @@ class MockNotifierQueueService extends NotifierQueueService {
190202 */
191203 public push ( action : NotifierAction ) : void {
192204 this . lastAction = action ;
205+ this . actionStream . next ( action ) ;
193206 }
194207}
0 commit comments