Skip to content

Commit

Permalink
Merged in DSC-1484-create-utility-functions-main (pull request DSpace…
Browse files Browse the repository at this point in the history
…#1275)

DSC-1484 create utility functions main

Approved-by: Davide Negretti
  • Loading branch information
vNovski authored and Davide Negretti committed Jan 26, 2024
2 parents c177d3b + 4e826d9 commit 4cd3982
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/app/core/services/internal-link.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,22 @@ describe('InternalLinkService', () => {

describe('transformInternalLink', () => {
it('should transform internal link by removing currentURL', () => {
const result = service.transformInternalLink('https://currentdomain/my-link');
const result = service.getRelativePath('https://currentdomain/my-link');
expect(result).toBe('/my-link');
});

it('should transform internal link by adding leading "/" if missing', () => {
const result = service.transformInternalLink('currentdomain/my-link');
const result = service.getRelativePath('currentdomain/my-link');
expect(result).toBe('/my-link');
});

it('should return unchanged link for external link', () => {
const result = service.transformInternalLink('https://externalDomain/my-link');
const result = service.getRelativePath('https://externalDomain/my-link');
expect(result).toBe('https://externalDomain/my-link');
});

it('should return unchanged link for internal link with leading "/"', () => {
const result = service.transformInternalLink('/my-link');
const result = service.getRelativePath('/my-link');
expect(result).toBe('/my-link');
});
});
Expand Down

0 comments on commit 4cd3982

Please sign in to comment.