mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-10 19:43:04 +00:00
Removed deprecated helper function async
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { BitstreamFormatsComponent } from './bitstream-formats.component';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
@@ -87,7 +87,7 @@ describe('BitstreamFormatsComponent', () => {
|
||||
bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', {
|
||||
findAll: observableOf(mockFormatsRD),
|
||||
find: createSuccessfulRemoteDataObject$(mockFormatsList[0]),
|
||||
getSelectedBitstreamFormats: hot('a', {a: mockFormatsList}),
|
||||
getSelectedBitstreamFormats: hot('a', { a: mockFormatsList }),
|
||||
selectBitstreamFormat: {},
|
||||
deselectBitstreamFormat: {},
|
||||
deselectAllBitstreamFormats: {},
|
||||
@@ -99,9 +99,9 @@ describe('BitstreamFormatsComponent', () => {
|
||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
||||
declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
|
||||
providers: [
|
||||
{provide: BitstreamFormatDataService, useValue: bitstreamFormatService},
|
||||
{provide: HostWindowService, useValue: new HostWindowServiceStub(0)},
|
||||
{provide: NotificationsService, useValue: notificationsServiceStub}
|
||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
||||
{ provide: NotificationsService, useValue: notificationsServiceStub }
|
||||
]
|
||||
}).compileComponents();
|
||||
};
|
||||
@@ -113,7 +113,7 @@ describe('BitstreamFormatsComponent', () => {
|
||||
};
|
||||
|
||||
describe('Bitstream format page content', () => {
|
||||
beforeEach(async(initAsync));
|
||||
beforeEach(waitForAsync(initAsync));
|
||||
beforeEach(initBeforeEach);
|
||||
|
||||
it('should contain four formats', () => {
|
||||
@@ -137,17 +137,17 @@ describe('BitstreamFormatsComponent', () => {
|
||||
});
|
||||
|
||||
describe('selectBitStreamFormat', () => {
|
||||
beforeEach(async(initAsync));
|
||||
beforeEach(waitForAsync(initAsync));
|
||||
beforeEach(initBeforeEach);
|
||||
it('should select a bitstreamFormat if it was selected in the event', () => {
|
||||
const event = {target: {checked: true}};
|
||||
const event = { target: { checked: true } };
|
||||
|
||||
comp.selectBitStreamFormat(bitstreamFormat1, event);
|
||||
|
||||
expect(bitstreamFormatService.selectBitstreamFormat).toHaveBeenCalledWith(bitstreamFormat1);
|
||||
});
|
||||
it('should deselect a bitstreamFormat if it is deselected in the event', () => {
|
||||
const event = {target: {checked: false}};
|
||||
const event = { target: { checked: false } };
|
||||
|
||||
comp.selectBitStreamFormat(bitstreamFormat1, event);
|
||||
|
||||
@@ -157,7 +157,7 @@ describe('BitstreamFormatsComponent', () => {
|
||||
spyOn(comp, 'selectBitStreamFormat');
|
||||
const unknownFormat = fixture.debugElement.query(By.css('#formats tr:nth-child(1) input'));
|
||||
|
||||
const event = {target: {checked: true}};
|
||||
const event = { target: { checked: true } };
|
||||
unknownFormat.triggerEventHandler('change', event);
|
||||
|
||||
expect(comp.selectBitStreamFormat).toHaveBeenCalledWith(bitstreamFormat1, event);
|
||||
@@ -165,12 +165,12 @@ describe('BitstreamFormatsComponent', () => {
|
||||
});
|
||||
|
||||
describe('isSelected', () => {
|
||||
beforeEach(async(initAsync));
|
||||
beforeEach(waitForAsync(initAsync));
|
||||
beforeEach(initBeforeEach);
|
||||
it('should return an observable of true if the provided bistream is in the list returned by the service', () => {
|
||||
const result = comp.isSelected(bitstreamFormat1);
|
||||
|
||||
expect(result).toBeObservable(cold('b', {b: true}));
|
||||
expect(result).toBeObservable(cold('b', { b: true }));
|
||||
});
|
||||
it('should return an observable of false if the provided bistream is not in the list returned by the service', () => {
|
||||
const format = new BitstreamFormat();
|
||||
@@ -178,12 +178,12 @@ describe('BitstreamFormatsComponent', () => {
|
||||
|
||||
const result = comp.isSelected(format);
|
||||
|
||||
expect(result).toBeObservable(cold('b', {b: false}));
|
||||
expect(result).toBeObservable(cold('b', { b: false }));
|
||||
});
|
||||
});
|
||||
|
||||
describe('deselectAll', () => {
|
||||
beforeEach(async(initAsync));
|
||||
beforeEach(waitForAsync(initAsync));
|
||||
beforeEach(initBeforeEach);
|
||||
it('should deselect all bitstreamFormats', () => {
|
||||
comp.deselectAll();
|
||||
@@ -201,7 +201,7 @@ describe('BitstreamFormatsComponent', () => {
|
||||
});
|
||||
|
||||
describe('deleteFormats success', () => {
|
||||
beforeEach(async(() => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
notificationsServiceStub = new NotificationsServiceStub();
|
||||
|
||||
scheduler = getTestScheduler();
|
||||
@@ -221,9 +221,9 @@ describe('BitstreamFormatsComponent', () => {
|
||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
||||
declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
|
||||
providers: [
|
||||
{provide: BitstreamFormatDataService, useValue: bitstreamFormatService},
|
||||
{provide: HostWindowService, useValue: new HostWindowServiceStub(0)},
|
||||
{provide: NotificationsService, useValue: notificationsServiceStub}
|
||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
||||
{ provide: NotificationsService, useValue: notificationsServiceStub }
|
||||
]
|
||||
}).compileComponents();
|
||||
}
|
||||
@@ -247,7 +247,7 @@ describe('BitstreamFormatsComponent', () => {
|
||||
});
|
||||
|
||||
describe('deleteFormats error', () => {
|
||||
beforeEach(async(() => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
notificationsServiceStub = new NotificationsServiceStub();
|
||||
|
||||
scheduler = getTestScheduler();
|
||||
@@ -267,9 +267,9 @@ describe('BitstreamFormatsComponent', () => {
|
||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
||||
declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
|
||||
providers: [
|
||||
{provide: BitstreamFormatDataService, useValue: bitstreamFormatService},
|
||||
{provide: HostWindowService, useValue: new HostWindowServiceStub(0)},
|
||||
{provide: NotificationsService, useValue: notificationsServiceStub}
|
||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
||||
{ provide: NotificationsService, useValue: notificationsServiceStub }
|
||||
]
|
||||
}).compileComponents();
|
||||
}
|
||||
|
Reference in New Issue
Block a user