Skip to content

Commit

Permalink
PER-8502
Browse files Browse the repository at this point in the history
Rewrote the test now that the code handles separate url and message instead of a string with an html tag.
  • Loading branch information
crisnicandrei committed Mar 6, 2024
1 parent 509255f commit 9bf5024
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/app/shared/components/message/message.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,15 @@ describe('MessageComponent', () => {
});

it('should display the external URL if it exists', () => {
component.externalUrl =
'<a class="test-link" href=https://www.example.com>Example</a>';
component.externalUrl = 'https://www.example.com';
component.externalMessage = 'test message';
component.visible = true;
fixture.detectChanges();

const externalLinkBody =
fixture.debugElement.nativeElement.querySelector('.link-body');

expect(externalLinkBody).toBeTruthy();

const externalLink =
fixture.debugElement.nativeElement.querySelector('.test-link');
const externalLink = fixture.debugElement.nativeElement.querySelector('a');

expect(externalLink).toBeTruthy();

expect(externalLink.href).toEqual('https://www.example.com/');
});
});

0 comments on commit 9bf5024

Please sign in to comment.