|
1 | 1 | import { notificationsReducer } from './notifications.reducers'; |
2 | 2 | import { NewNotificationAction, RemoveAllNotificationsAction, RemoveNotificationAction } from './notifications.actions'; |
3 | 3 | import { NotificationsService } from './notifications.service'; |
4 | | -import { fakeAsync, flush, inject, TestBed, tick } from '@angular/core/testing'; |
| 4 | +import { TestBed } from '@angular/core/testing'; |
5 | 5 | import { NotificationsBoardComponent } from './notifications-board/notifications-board.component'; |
6 | 6 | import { StoreModule } from '@ngrx/store'; |
7 | 7 | import { NotificationComponent } from './notification/notification.component'; |
@@ -106,38 +106,4 @@ describe('Notifications reducer', () => { |
106 | 106 | expect(state3.length).toEqual(0); |
107 | 107 | }); |
108 | 108 |
|
109 | | - it('should create 2 notifications and check they close after different timeout', fakeAsync(() => { |
110 | | - inject([ChangeDetectorRef], (cdr: ChangeDetectorRef) => { |
111 | | - const optionsWithTimeout = new NotificationOptions( |
112 | | - 1000, |
113 | | - true, |
114 | | - NotificationAnimationsType.Rotate); |
115 | | - // Timeout 1000ms |
116 | | - const notification = new Notification(uniqueId(), NotificationType.Success, 'title', 'content', optionsWithTimeout, null); |
117 | | - const state = notificationsReducer(undefined, new NewNotificationAction(notification)); |
118 | | - expect(state.length).toEqual(1); |
119 | | - |
120 | | - // Timeout default 5000ms |
121 | | - const notificationBis = new Notification(uniqueId(), NotificationType.Success, 'title', 'content'); |
122 | | - const stateBis = notificationsReducer(state, new NewNotificationAction(notification)); |
123 | | - expect(stateBis.length).toEqual(2); |
124 | | - |
125 | | - tick(1000); |
126 | | - cdr.detectChanges(); |
127 | | - |
128 | | - const action = new NewNotificationAction(notification); |
129 | | - action.type = 'NothingToDo, return only the state'; |
130 | | - |
131 | | - const lastState = notificationsReducer(stateBis, action); |
132 | | - expect(lastState.length).toEqual(1); |
133 | | - |
134 | | - flush(); |
135 | | - cdr.detectChanges(); |
136 | | - |
137 | | - const finalState = notificationsReducer(lastState, action); |
138 | | - expect(finalState.length).toEqual(0); |
139 | | - }); |
140 | | - |
141 | | - })); |
142 | | - |
143 | 109 | }); |
0 commit comments