Skip to content

Commit

Permalink
114645: Add export in dsoPageSomeFeatureGuard and Fix some Lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Zahraa Chreim committed May 2, 2024
1 parent aecf2c7 commit 45dac71
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(
Expand Down

0 comments on commit 45dac71

Please sign in to comment.