Alexandre Vryghem
2024-02-29 21:06:43 +01:00
parent db710c59bb
commit a340eb2a07
2 changed files with 1 additions and 41 deletions

View File

@@ -96,12 +96,6 @@ describe('ExternalSourceService', () => {
result.pipe(take(1)).subscribe();
expect(requestService.send).toHaveBeenCalledWith(jasmine.any(GetRequest), false);
});
it('should return the entries', () => {
result.subscribe((resultRD) => {
expect(resultRD.payload.page).toBe(entries);
});
});
});
});
});

View File

@@ -1,7 +1,7 @@
import { notificationsReducer } from './notifications.reducers';
import { NewNotificationAction, RemoveAllNotificationsAction, RemoveNotificationAction } from './notifications.actions';
import { NotificationsService } from './notifications.service';
import { fakeAsync, flush, inject, TestBed, tick } from '@angular/core/testing';
import { TestBed } from '@angular/core/testing';
import { NotificationsBoardComponent } from './notifications-board/notifications-board.component';
import { StoreModule } from '@ngrx/store';
import { NotificationComponent } from './notification/notification.component';
@@ -106,38 +106,4 @@ describe('Notifications reducer', () => {
expect(state3.length).toEqual(0);
});
it('should create 2 notifications and check they close after different timeout', fakeAsync(() => {
inject([ChangeDetectorRef], (cdr: ChangeDetectorRef) => {
const optionsWithTimeout = new NotificationOptions(
1000,
true,
NotificationAnimationsType.Rotate);
// Timeout 1000ms
const notification = new Notification(uniqueId(), NotificationType.Success, 'title', 'content', optionsWithTimeout, null);
const state = notificationsReducer(undefined, new NewNotificationAction(notification));
expect(state.length).toEqual(1);
// Timeout default 5000ms
const notificationBis = new Notification(uniqueId(), NotificationType.Success, 'title', 'content');
const stateBis = notificationsReducer(state, new NewNotificationAction(notification));
expect(stateBis.length).toEqual(2);
tick(1000);
cdr.detectChanges();
const action = new NewNotificationAction(notification);
action.type = 'NothingToDo, return only the state';
const lastState = notificationsReducer(stateBis, action);
expect(lastState.length).toEqual(1);
flush();
cdr.detectChanges();
const finalState = notificationsReducer(lastState, action);
expect(finalState.length).toEqual(0);
});
}));
});