114645: Add export in dsoPageSomeFeatureGuard and Fix some Lint issues

This commit is contained in:
Zahraa Chreim
2024-05-02 14:06:48 +03:00
parent aecf2c7b61
commit 45dac71e9b
2 changed files with 4 additions and 5 deletions

View File

@@ -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', () => {

View File

@@ -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(