Skip to content

Commit e47bc32

Browse files
committed
[DSC-2434] Fix build after merge
1 parent 628069c commit e47bc32

16 files changed

Lines changed: 59 additions & 91 deletions

File tree

src/app/admin/admin-workflow-page/admin-workflow.module.ts

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/app/collection-page/collection-page.component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import { By } from '@angular/platform-browser';
1212
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
1313
import {
1414
ActivatedRoute,
15+
provideRouter,
1516
Router,
1617
} from '@angular/router';
17-
import { RouterTestingModule } from '@angular/router/testing';
1818
import { TranslateModule } from '@ngx-translate/core';
1919
import { cold } from 'jasmine-marbles';
2020
import { of } from 'rxjs';
@@ -44,7 +44,6 @@ import {
4444
import { ActivatedRouteStub } from '../shared/testing/active-router.stub';
4545
import { RouterStub } from '../shared/testing/router.stub';
4646
import { VarDirective } from '../shared/utils/var.directive';
47-
import { ViewTrackerComponent } from '../statistics/angulartics/dspace/view-tracker.component';
4847
import { CollectionPageComponent } from './collection-page.component';
4948

5049
describe('CollectionPageComponent', () => {
@@ -78,8 +77,9 @@ describe('CollectionPageComponent', () => {
7877
dsoNameServiceSpy = jasmine.createSpyObj('DSONameService', ['getName']);
7978

8079
await TestBed.configureTestingModule({
81-
imports: [RouterTestingModule, FormsModule, TranslateModule.forRoot(), BrowserAnimationsModule, CollectionPageComponent, VarDirective],
80+
imports: [FormsModule, TranslateModule.forRoot(), BrowserAnimationsModule, CollectionPageComponent, VarDirective],
8281
providers: [
82+
provideRouter([]),
8383
{ provide: ActivatedRoute, useValue: aroute },
8484
{ provide: Router, useValue: router },
8585
{ provide: AuthService, useValue: authServiceSpy },
@@ -90,7 +90,7 @@ describe('CollectionPageComponent', () => {
9090
],
9191
schemas: [NO_ERRORS_SCHEMA],
9292
})
93-
.overrideComponent(CollectionPageComponent, { remove: { imports: [ThemedComcolPageContentComponent, ErrorComponent, ThemedLoadingComponent, ViewTrackerComponent, ComcolPageHeaderComponent, ComcolPageLogoComponent, ThemedComcolPageHandleComponent, DsoEditMenuComponent, ThemedComcolPageBrowseByComponent, ObjectCollectionComponent, ContextMenuComponent] } }).compileComponents();
93+
.overrideComponent(CollectionPageComponent, { remove: { imports: [ThemedComcolPageContentComponent, ErrorComponent, ThemedLoadingComponent, ComcolPageHeaderComponent, ComcolPageLogoComponent, ThemedComcolPageHandleComponent, DsoEditMenuComponent, ThemedComcolPageBrowseByComponent, ObjectCollectionComponent, ContextMenuComponent] } }).compileComponents();
9494
});
9595

9696
beforeEach(() => {

src/app/community-page/community-page.component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import { By } from '@angular/platform-browser';
99
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
1010
import {
1111
ActivatedRoute,
12+
provideRouter,
1213
Router,
1314
} from '@angular/router';
14-
import { RouterTestingModule } from '@angular/router/testing';
1515
import { TranslateModule } from '@ngx-translate/core';
1616
import { cold } from 'jasmine-marbles';
1717
import { of } from 'rxjs';
@@ -38,7 +38,6 @@ import {
3838
import { ActivatedRouteStub } from '../shared/testing/active-router.stub';
3939
import { RouterStub } from '../shared/testing/router.stub';
4040
import { VarDirective } from '../shared/utils/var.directive';
41-
import { ViewTrackerComponent } from '../statistics/angulartics/dspace/view-tracker.component';
4241
import { CommunityPageComponent } from './community-page.component';
4342
import { ThemedCollectionPageSubCollectionListComponent } from './sections/sub-com-col-section/sub-collection-list/themed-community-page-sub-collection-list.component';
4443
import { ThemedCommunityPageSubCommunityListComponent } from './sections/sub-com-col-section/sub-community-list/themed-community-page-sub-community-list.component';
@@ -90,16 +89,17 @@ describe('CommunityPageComponent', () => {
9089
authorizationDataServiceSpy = jasmine.createSpyObj('AuthorizationDataService', ['isAuthorized']);
9190
dsoNameServiceSpy = jasmine.createSpyObj('DSONameService', ['getName']);
9291
await TestBed.configureTestingModule({
93-
imports: [RouterTestingModule, FormsModule, TranslateModule.forRoot(), BrowserAnimationsModule, CommunityPageComponent, VarDirective],
92+
imports: [FormsModule, TranslateModule.forRoot(), BrowserAnimationsModule, CommunityPageComponent, VarDirective],
9493
providers: [
94+
provideRouter([]),
9595
{ provide: ActivatedRoute, useValue: aroute },
9696
{ provide: Router, useValue: router },
9797
{ provide: AuthService, useValue: authServiceSpy },
9898
{ provide: AuthorizationDataService, useValue: authorizationDataServiceSpy },
9999
{ provide: DSONameService, useValue: dsoNameServiceSpy },
100100
],
101101
schemas: [NO_ERRORS_SCHEMA],
102-
}).overrideComponent(CommunityPageComponent, { remove: { imports: [ThemedComcolPageContentComponent, ErrorComponent, ThemedLoadingComponent, ThemedCommunityPageSubCommunityListComponent, ThemedCollectionPageSubCollectionListComponent, ThemedComcolPageBrowseByComponent, DsoEditMenuComponent, ThemedComcolPageHandleComponent, ComcolPageLogoComponent, ComcolPageHeaderComponent, ViewTrackerComponent, ContextMenuComponent] } }).compileComponents();
102+
}).overrideComponent(CommunityPageComponent, { remove: { imports: [ThemedComcolPageContentComponent, ErrorComponent, ThemedLoadingComponent, ThemedCommunityPageSubCommunityListComponent, ThemedCollectionPageSubCollectionListComponent, ThemedComcolPageBrowseByComponent, DsoEditMenuComponent, ThemedComcolPageHandleComponent, ComcolPageLogoComponent, ComcolPageHeaderComponent, ContextMenuComponent] } }).compileComponents();
103103
});
104104

105105
beforeEach(() => {

src/app/core/auth/auth.service.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ import { NoContent } from '../shared/NoContent.model';
5555
import {
5656
getAllSucceededRemoteDataPayload,
5757
getFirstCompletedRemoteData,
58-
getFirstSucceededRemoteDataPayload,
5958
} from '../shared/operators';
6059
import { PageInfo } from '../shared/page-info.model';
6160
import { URLCombiner } from '../url-combiner/url-combiner';
@@ -263,14 +262,8 @@ export class AuthService {
263262
*/
264263
public getAuthenticatedUserFromStoreIfAuthenticated(): Observable<EPerson> {
265264
return this.store.pipe(
266-
select(getAuthenticatedUserId),
267-
switchMap((id: string) => {
268-
if (hasValue(id)) {
269-
return this.epersonService.findById(id).pipe(getFirstSucceededRemoteDataPayload());
270-
} else {
271-
return observableOf(null);
272-
}
273-
}),
265+
select(getAuthenticatedUser),
266+
switchMap(() => this.getAuthenticatedUserFromStore()),
274267
);
275268
}
276269

src/app/core/shared/search/search.service.spec.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import SpyObj = jasmine.SpyObj;
3232
import { Component } from '@angular/core';
3333

3434
import { APP_DATA_SERVICES_MAP } from '../../../../config/app-config.interface';
35+
import { CommunityDataService } from '../../../core/data/community-data.service';
3536

3637
@Component({
3738
template: '',
@@ -55,6 +56,10 @@ describe('SearchService', () => {
5556
let msToLive: number;
5657
let remoteDataTimestamp: number;
5758

59+
const options: PaginatedSearchOptions = new PaginatedSearchOptions({
60+
forcedEmbeddedKeys: [],
61+
});
62+
5863
beforeEach(() => {
5964
halService = new HALEndpointServiceStub(environment.rest.baseUrl);
6065
paginationService = new PaginationServiceStub();
@@ -74,6 +79,7 @@ describe('SearchService', () => {
7479
{ provide: RequestService, useValue: requestService },
7580
{ provide: RemoteDataBuildService, useValue: remoteDataBuildService },
7681
{ provide: HALEndpointService, useValue: halService },
82+
{ provide: CommunityDataService, useValue: {} },
7783
{ provide: DSpaceObjectDataService, useValue: {} },
7884
{ provide: PaginationService, useValue: paginationService },
7985
{ provide: SearchConfigurationService, useValue: searchConfigService },
@@ -176,7 +182,7 @@ describe('SearchService', () => {
176182
e: remoteDataMocks.SuccessStale,
177183
};
178184

179-
expectObservable(service.search(undefined, msToLive, true)).toBe(expected, values);
185+
expectObservable(service.search(options, msToLive, true)).toBe(expected, values);
180186
});
181187
});
182188
});
@@ -204,7 +210,7 @@ describe('SearchService', () => {
204210
e: remoteDataMocks.SuccessStale,
205211
};
206212

207-
expectObservable(service.search(undefined, msToLive, false)).toBe(expected, values);
213+
expectObservable(service.search(options, msToLive, false)).toBe(expected, values);
208214
});
209215
});
210216

@@ -219,7 +225,7 @@ describe('SearchService', () => {
219225
a: remoteDataMocks.Success,
220226
b: remoteDataMocks.SuccessStale,
221227
};
222-
expectObservable(service.search(undefined, msToLive, false)).toBe(expected, values);
228+
expectObservable(service.search(options, msToLive, false)).toBe(expected, values);
223229
});
224230
});
225231
});

src/app/cris-item-page/cris-item-page.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<div class="container">
44
<ds-item-alerts [item]="(itemRD$ | async)?.payload"></ds-item-alerts>
55
</div>
6-
<ds-view-tracker [object]="(itemRD$ | async)?.payload"></ds-view-tracker>
76
<ds-cris-layout *ngIf="!((itemRD$ | async)?.payload?.isWithdrawn) || (isAdmin$|async)"
87
[item]="(itemRD$ | async)?.payload"></ds-cris-layout>
98
</ng-container>

src/app/cris-item-page/cris-item-page.component.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import {
3434
import { ActivatedRouteStub } from '../shared/testing/active-router.stub';
3535
import { createPaginatedList } from '../shared/testing/utils.test';
3636
import { VarDirective } from '../shared/utils/var.directive';
37-
import { ViewTrackerComponent } from '../statistics/angulartics/dspace/view-tracker.component';
3837
import { CrisItemPageComponent } from './cris-item-page.component';
3938

4039
const mockItem: Item = Object.assign(new Item(), {
@@ -77,7 +76,7 @@ describe('CrisItemPageComponent', () => {
7776
],
7877
schemas: [NO_ERRORS_SCHEMA],
7978
})
80-
.overrideComponent(CrisItemPageComponent, { remove: { imports: [ThemedLoadingComponent, ThemedItemAlertsComponent, ViewTrackerComponent, CrisLayoutComponent] } }).compileComponents();
79+
.overrideComponent(CrisItemPageComponent, { remove: { imports: [ThemedLoadingComponent, ThemedItemAlertsComponent, CrisLayoutComponent] } }).compileComponents();
8180
}));
8281

8382
beforeEach(() => {

src/app/cris-item-page/cris-item-page.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { CrisLayoutComponent } from '../cris-layout/cris-layout.component';
1919
import { ThemedItemAlertsComponent } from '../item-page/alerts/themed-item-alerts.component';
2020
import { fadeInOut } from '../shared/animations/fade';
2121
import { ThemedLoadingComponent } from '../shared/loading/themed-loading.component';
22-
import { ViewTrackerComponent } from '../statistics/angulartics/dspace/view-tracker.component';
2322

2423
/**
2524
* This component is the entry point for the page that renders items.
@@ -34,7 +33,6 @@ import { ViewTrackerComponent } from '../statistics/angulartics/dspace/view-trac
3433
NgIf,
3534
ThemedLoadingComponent,
3635
ThemedItemAlertsComponent,
37-
ViewTrackerComponent,
3836
CrisLayoutComponent,
3937
AsyncPipe,
4038
TranslateModule,

src/app/item-page/orcid-page/orcid-auth/orcid-auth.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from '@angular/core/testing';
1111
import { By } from '@angular/platform-browser';
1212
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
13-
import { RouterTestingModule } from '@angular/router/testing';
13+
import { provideRouter } from '@angular/router';
1414
import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap';
1515
import {
1616
TranslateLoader,
@@ -145,11 +145,11 @@ describe('OrcidAuthComponent test suite', () => {
145145
useClass: TranslateLoaderMock,
146146
},
147147
}),
148-
RouterTestingModule.withRoutes([]),
149148
OrcidAuthComponent,
150149
NoopAnimationsModule,
151150
],
152151
providers: [
152+
provideRouter([]),
153153
{ provide: NativeWindowService, useFactory: NativeWindowMockFactory },
154154
{ provide: NotificationsService, useClass: NotificationsServiceStub },
155155
{ provide: OrcidAuthService, useValue: orcidAuthService },

src/app/item-page/orcid-page/orcid-auth/orcid-auth.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class OrcidAuthComponent implements OnInit, OnChanges {
6363
/**
6464
* The list of exposed orcid authorization scopes for the orcid profile
6565
*/
66-
profileAuthorizationScopes$: BehaviorSubject<string[]> = new BehaviorSubject([]);
66+
profileAuthorizationScopes$: BehaviorSubject<string[]> = new BehaviorSubject<string[]>([]);
6767

6868
/**
6969
* A boolean representing if user has authorizations
@@ -73,7 +73,7 @@ export class OrcidAuthComponent implements OnInit, OnChanges {
7373
/**
7474
* The list of all orcid authorization scopes missing in the orcid profile
7575
*/
76-
missingAuthorizationScopes: BehaviorSubject<string[]> = new BehaviorSubject([]);
76+
missingAuthorizationScopes: BehaviorSubject<string[]> = new BehaviorSubject<string[]>([]);
7777

7878
/**
7979
* A boolean representing if user has missing authorizations
@@ -83,12 +83,12 @@ export class OrcidAuthComponent implements OnInit, OnChanges {
8383
/**
8484
* The list of all orcid authorization scopes available
8585
*/
86-
orcidAuthorizationScopes: BehaviorSubject<string[]> = new BehaviorSubject([]);
86+
orcidAuthorizationScopes: BehaviorSubject<string[]> = new BehaviorSubject<string[]>([]);
8787

8888
/**
8989
* A boolean representing if unlink operation is processing
9090
*/
91-
unlinkProcessing: BehaviorSubject<boolean> = new BehaviorSubject(false);
91+
unlinkProcessing: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
9292

9393
/**
9494
* A boolean representing if orcid profile is linked
@@ -157,9 +157,9 @@ export class OrcidAuthComponent implements OnInit, OnChanges {
157157
getOrcidNotLinkedMessage(): Observable<string> {
158158
const orcid = this.item.firstMetadataValue('person.identifier.orcid');
159159
if (orcid) {
160-
return this.translateService.instant('person.page.orcid.orcid-not-linked-message', { 'orcid': orcid });
160+
return this.translateService.get('person.page.orcid.orcid-not-linked-message', { 'orcid': orcid });
161161
} else {
162-
return this.translateService.instant('person.page.orcid.no-orcid-message');
162+
return this.translateService.get('person.page.orcid.no-orcid-message');
163163
}
164164
}
165165

0 commit comments

Comments
 (0)