Skip to content

Commit

Permalink
Add test case for empty or falsy URL in filterURLForDisplay function
Browse files Browse the repository at this point in the history
  • Loading branch information
amitraj2203 committed Jun 7, 2024
1 parent a8291bf commit 6a974d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/url/src/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,12 @@ describe( 'safeDecodeURI', () => {
} );

describe( 'filterURLForDisplay', () => {
it( 'should return an empty string if the url is empty or falsy', () => {
let url = filterURLForDisplay( '' );
expect( url ).toBe( '' );
url = filterURLForDisplay( null );
expect( url ).toBe( '' );
} );
it( 'should remove protocol', () => {
let url = filterURLForDisplay( 'http://wordpress.org' );
expect( url ).toBe( 'wordpress.org' );
Expand Down

0 comments on commit 6a974d3

Please sign in to comment.