From f355a89d68edc2f01cd087b243734b2e300127aa Mon Sep 17 00:00:00 2001 From: Giuseppe Digilio <giuseppe.digilio@4science.it> Date: Thu, 8 Mar 2018 17:01:44 +0100 Subject: [PATCH] Fixed notifications.service.spec.ts --- .../notifications.service.spec.ts | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/app/shared/notifications/notifications.service.spec.ts b/src/app/shared/notifications/notifications.service.spec.ts index 6dca013b6e..ceb2afa381 100644 --- a/src/app/shared/notifications/notifications.service.spec.ts +++ b/src/app/shared/notifications/notifications.service.spec.ts @@ -7,6 +7,7 @@ import { NotificationsBoardComponent } from './notifications-board/notifications import { NotificationComponent } from './notification/notification.component'; import { StoreModule } from '@ngrx/store'; import { notificationsReducer } from './notifications.reducers'; +import { Observable } from 'rxjs/Observable'; describe('NotificationsService', () => { beforeEach(async () => { @@ -21,18 +22,18 @@ describe('NotificationsService', () => { it('Default options', inject([NotificationsService], (service: NotificationsService) => { - const notification = service.success('Title', 'Content'); + const notification = service.success('Title', Observable.of('Content')); expect(notification.options.clickToClose).toBe(true); }) ); it('Success method', inject([NotificationsService], (service: NotificationsService) => { - const notification = service.success('Title', 'Content'); + const notification = service.success(Observable.of('Title'), Observable.of('Content')); expect(notification.id !== undefined).toBeTruthy(); expect(notification.type).toBe(NotificationType.Success); - expect(notification.title).toBe('Title'); - expect(notification.content).toBe('Content'); + expect(notification.title).toBe(Observable.of('Title')); + expect(notification.content).toBe(Observable.of('Content')); expect(notification.html).toBeUndefined(); expect(notification.options.timeOut).toBe(0); expect(notification.options.clickToClose).toBeTruthy(); @@ -42,11 +43,11 @@ describe('NotificationsService', () => { it('Error method', inject([NotificationsService], (service: NotificationsService) => { - const notification = service.error('Title', 'Content'); + const notification = service.error(Observable.of('Title'), Observable.of('Content')); expect(notification.id !== undefined).toBeTruthy(); expect(notification.type).toBe(NotificationType.Error); - expect(notification.title).toBe('Title'); - expect(notification.content).toBe('Content'); + expect(notification.title).toBe(Observable.of('Title')); + expect(notification.content).toBe(Observable.of('Content')); expect(notification.html).toBeUndefined(); expect(notification.options.timeOut).toBe(0); expect(notification.options.clickToClose).toBeTruthy(); @@ -56,11 +57,11 @@ describe('NotificationsService', () => { it('Warning method', inject([NotificationsService], (service: NotificationsService) => { - const notification = service.warning('Title', 'Content'); + const notification = service.warning(Observable.of('Title'), Observable.of('Content')); expect(notification.id !== undefined).toBeTruthy(); expect(notification.type).toBe(NotificationType.Warning); - expect(notification.title).toBe('Title'); - expect(notification.content).toBe('Content'); + expect(notification.title).toBe(Observable.of('Title')); + expect(notification.content).toBe(Observable.of('Content')); expect(notification.html).toBeUndefined(); expect(notification.options.timeOut).toBe(0); expect(notification.options.clickToClose).toBeTruthy(); @@ -70,11 +71,11 @@ describe('NotificationsService', () => { it('Info method', inject([NotificationsService], (service: NotificationsService) => { - const notification = service.info('Title', 'Content'); + const notification = service.info(Observable.of('Title'), Observable.of('Content')); expect(notification.id !== undefined).toBeTruthy(); expect(notification.type).toBe(NotificationType.Info); - expect(notification.title).toBe('Title'); - expect(notification.content).toBe('Content'); + expect(notification.title).toBe(Observable.of('Title')); + expect(notification.content).toBe(Observable.of(Observable.of('Content'))); expect(notification.html).toBeUndefined(); expect(notification.options.timeOut).toBe(0); expect(notification.options.clickToClose).toBeTruthy(); -- GitLab