mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
114645: Add export in dsoPageSomeFeatureGuard and Fix some Lint issues
This commit is contained in:
@@ -18,7 +18,6 @@ describe('dsoPageSomeFeatureGuard and its functions', () => {
|
||||
let authorizationService: AuthorizationDataService;
|
||||
let router: Router;
|
||||
let authService: AuthService;
|
||||
// let resolver: Resolve<RemoteData<any>>;
|
||||
let resolver: ResolveFn<Observable<RemoteData<any>>>;
|
||||
let object: DSpaceObject;
|
||||
let route;
|
||||
@@ -74,14 +73,14 @@ describe('dsoPageSomeFeatureGuard and its functions', () => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('getRouteWithDSOId', () => {
|
||||
it('should return the route that has the UUID of the DSO', () => {
|
||||
const foundRoute = getRouteWithDSOId(route);
|
||||
expect(foundRoute).toBe(parentRoute);
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
describe('dsoPageSomeFeatureGuard', () => {
|
||||
|
@@ -19,7 +19,7 @@ export declare type DSOGetObjectURlFn = <T extends DSpaceObject>(resolve: Resolv
|
||||
* Method to resolve resolve (parent) route that contains the UUID of the DSO
|
||||
* @param route The current route
|
||||
*/
|
||||
const getRouteWithDSOId = (route: ActivatedRouteSnapshot): ActivatedRouteSnapshot => {
|
||||
export const getRouteWithDSOId = (route: ActivatedRouteSnapshot): ActivatedRouteSnapshot => {
|
||||
let routeWithDSOId = route;
|
||||
while (hasNoValue(routeWithDSOId.params.id) && hasValue(routeWithDSOId.parent)) {
|
||||
routeWithDSOId = routeWithDSOId.parent;
|
||||
@@ -29,7 +29,7 @@ const getRouteWithDSOId = (route: ActivatedRouteSnapshot): ActivatedRouteSnapsho
|
||||
|
||||
|
||||
|
||||
const defaultDSOGetObjectUrl: DSOGetObjectURlFn = <T extends DSpaceObject>(resolve: ResolveFn<Observable<RemoteData<T>>>): StringGuardParamFn => {
|
||||
export const defaultDSOGetObjectUrl: DSOGetObjectURlFn = <T extends DSpaceObject>(resolve: ResolveFn<Observable<RemoteData<T>>>): StringGuardParamFn => {
|
||||
return (route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<string> => {
|
||||
const routeWithObjectID = getRouteWithDSOId(route);
|
||||
return (resolve(routeWithObjectID, state) as Observable<RemoteData<T>>).pipe(
|
||||
|
Reference in New Issue
Block a user