File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
src/components/IssueList/__tests__ Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -79,11 +79,20 @@ describe("IssueList", () => {
7979 expect ( screen . queryByText ( "Assigned issue" ) ) . not . toBeInTheDocument ( ) ;
8080 expect ( screen . queryByText ( "Closed issue" ) ) . not . toBeInTheDocument ( ) ;
8181
82- const issueLinks = screen
83- . getAllByRole ( "link" )
84- . filter ( link =>
85- link . getAttribute ( "href" ) ?. startsWith ( "https://issues.example" ) ,
86- ) ;
82+ const issueLinks = screen . getAllByRole ( "link" ) . filter ( link => {
83+ const href = link . getAttribute ( "href" ) ;
84+
85+ if ( ! href ) {
86+ return false ;
87+ }
88+
89+ try {
90+ const url = new URL ( href ) ;
91+ return url . protocol === "https:" && url . hostname === "issues.example" ;
92+ } catch {
93+ return false ;
94+ }
95+ } ) ;
8796
8897 expect ( issueLinks . map ( link => link . textContent ) ) . toEqual ( [
8998 "Go issue" ,
You can’t perform that action at this time.
0 commit comments