Skip to content

Commit 24ef528

Browse files
author
Andrea Barbasso
committed
[DSC-2256] fix deprecated methods in spec files
1 parent ae3a148 commit 24ef528

25 files changed

Lines changed: 59 additions & 50 deletions

File tree

src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ describe('EPersonFormComponent', () => {
550550

551551
describe('findListByHref functionality', () => {
552552
it('retrieves groups and object on page change', fakeAsync(() => {
553-
component.activeEPerson$ = observableOf({ _links: { groups: { href: 'groups' } } } as EPerson);
553+
component.activeEPerson$ = of({ _links: { groups: { href: 'groups' } } } as EPerson);
554554

555555
const options = { currentPage: 1, elementsPerPage: 5 };
556556
component.onPageChange(options.currentPage);

src/app/admin/admin-edit-user-agreement/admin-edit-user-agreement.component.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { CommonModule } from '@angular/common';
22
import { NO_ERRORS_SCHEMA } from '@angular/core';
33
import {
4-
async,
54
ComponentFixture,
65
inject,
76
TestBed,
7+
waitForAsync,
88
} from '@angular/core/testing';
99
import {
1010
FormsModule,
@@ -53,7 +53,7 @@ describe('AdminEditUserAgreementComponent', () => {
5353
},
5454
});
5555

56-
beforeEach(async(() => {
56+
beforeEach(waitForAsync(() => {
5757

5858
scriptDataService = {};
5959
notificationService = new NotificationsServiceStub();
@@ -89,7 +89,7 @@ describe('AdminEditUserAgreementComponent', () => {
8989
expect(comp).toBeDefined();
9090
}));
9191

92-
it('should fill the text areas with the dc.rights values', async(() => {
92+
it('should fill the text areas with the dc.rights values', waitForAsync(() => {
9393
expect(component.userAgreementTexts.get('en').text).toEqual('This is the End User Agreement text for this test');
9494
expect(component.userAgreementTexts.get('de').text).toEqual('Dies ist der Text der Endbenutzervereinbarung für diesen Test');
9595
}));

src/app/admin/admin-notifications/admin-notifications-suggestion-targets-page/admin-notifications-suggestion-targets-page.component.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import { CommonModule } from '@angular/common';
22
import { NO_ERRORS_SCHEMA } from '@angular/core';
33
import {
4-
async,
54
ComponentFixture,
65
TestBed,
6+
waitForAsync,
77
} from '@angular/core/testing';
88
import { TranslateModule } from '@ngx-translate/core';
99

10-
import { PublicationClaimComponent } from '../../../notifications/suggestion-targets/publication-claim/publication-claim.component';
10+
import { PublicationClaimComponent } from '../../../notifications/suggestions/targets/publication-claim/publication-claim.component';
1111
import { AdminNotificationsSuggestionTargetsPageComponent } from './admin-notifications-suggestion-targets-page.component';
1212

1313
describe('AdminNotificationsSuggestionTargetsPageComponent', () => {
1414
let component: AdminNotificationsSuggestionTargetsPageComponent;
1515
let fixture: ComponentFixture<AdminNotificationsSuggestionTargetsPageComponent>;
1616

17-
beforeEach(async(() => {
17+
beforeEach(waitForAsync(() => {
1818
TestBed.configureTestingModule({
1919
imports: [
2020
CommonModule,

src/app/charts/components/chart/chart.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { EventEmitter } from '@angular/core';
22
import {
3-
async,
43
ComponentFixture,
54
TestBed,
5+
waitForAsync,
66
} from '@angular/core/testing';
77
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
88
import { NgxChartsModule } from '@swimlane/ngx-charts';
@@ -44,7 +44,7 @@ xdescribe('ChartComponent', () => {
4444
const currentPage = 1;
4545
const type = ChartType.BAR;
4646

47-
beforeEach(async(() => {
47+
beforeEach(waitForAsync(() => {
4848
TestBed.configureTestingModule({
4949
imports: [
5050
BrowserAnimationsModule,

src/app/charts/components/line-chart/line-chart.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import {
33
Injector,
44
} from '@angular/core';
55
import {
6-
async,
76
ComponentFixture,
87
TestBed,
8+
waitForAsync,
99
} from '@angular/core/testing';
1010
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
1111
import { NgxChartsModule } from '@swimlane/ngx-charts';
@@ -96,7 +96,7 @@ xdescribe('LineChartComponent', () => {
9696
const currentPage = false;
9797
const type = ChartType.BAR;
9898

99-
beforeEach(async(() => {
99+
beforeEach(waitForAsync(() => {
100100
TestBed.configureTestingModule({
101101
imports: [
102102
BrowserAnimationsModule,

src/app/shared/context-menu/edit-item/edit-item-menu.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
2-
async,
32
ComponentFixture,
43
TestBed,
4+
waitForAsync,
55
} from '@angular/core/testing';
66
import { By } from '@angular/platform-browser';
77
import { RouterTestingModule } from '@angular/router/testing';
@@ -44,7 +44,7 @@ describe('EditItemMenuComponent', () => {
4444
modes: createSuccessfulRemoteDataObject$(createPaginatedList([])),
4545
});
4646

47-
beforeEach(async(() => {
47+
beforeEach(waitForAsync(() => {
4848
dso = Object.assign(new Item(), {
4949
id: 'test-item',
5050
_links: {

src/app/shared/context-menu/export-item/export-item-menu.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
2-
async,
32
ComponentFixture,
43
TestBed,
4+
waitForAsync,
55
} from '@angular/core/testing';
66
import { By } from '@angular/platform-browser';
77
import { RouterTestingModule } from '@angular/router/testing';
@@ -39,7 +39,7 @@ describe('ExportItemMenuComponent', () => {
3939
submitForm: jasmine.createSpy('submitForm'),
4040
});
4141

42-
beforeEach(async(() => {
42+
beforeEach(waitForAsync(() => {
4343
itemExportService.initialItemExportFormConfiguration.and.returnValue(of(configuration));
4444
dso = Object.assign(new Item(), {
4545
id: 'test-item',

src/app/shared/context-menu/request-correction/request-correction-menu.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
2-
async,
32
ComponentFixture,
43
TestBed,
4+
waitForAsync,
55
} from '@angular/core/testing';
66
import { By } from '@angular/platform-browser';
77
import { Router } from '@angular/router';
@@ -81,7 +81,7 @@ describe('RequestCorrectionMenuComponent', () => {
8181
item: createSuccessfulRemoteDataObject$(mockItem),
8282
});
8383

84-
beforeEach(async(() => {
84+
beforeEach(waitForAsync(() => {
8585
dso = Object.assign(new Item(), {
8686
id: 'test-item',
8787
_links: {

src/app/shared/context-menu/statistics/statistics-menu.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
2-
async,
32
ComponentFixture,
43
TestBed,
4+
waitForAsync,
55
} from '@angular/core/testing';
66
import { By } from '@angular/platform-browser';
77
import { RouterTestingModule } from '@angular/router/testing';
@@ -25,7 +25,7 @@ describe('StatisticsMenuComponent', () => {
2525
let authorizationService: AuthorizationDataService;
2626
let dso: DSpaceObject;
2727

28-
beforeEach(async(() => {
28+
beforeEach(waitForAsync(() => {
2929
dso = Object.assign(new Item(), {
3030
id: 'test-item',
3131
_links: {
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
import { of } from 'rxjs';
1+
import {
2+
BehaviorSubject,
3+
of,
4+
} from 'rxjs';
25

36
export class OrejimeServiceStub {
47
initialize = jasmine.createSpy('initialize');
58

69
showSettings = jasmine.createSpy('showSettings');
710

811
getSavedPreferences = jasmine.createSpy('getSavedPreferences').and.returnValue(of({}));
12+
13+
watchConsentUpdates = jasmine.createSpy('watchConsentUpdates').and.returnValue(of(null));
14+
15+
consentsUpdates$: BehaviorSubject<any> = new BehaviorSubject<any>(null);
16+
17+
initialized$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(true);
918
}

0 commit comments

Comments
 (0)