@@ -792,9 +792,9 @@ describe('#unit url-util', () => {
792
792
} )
793
793
} )
794
794
795
- function verifyUrl ( urlString : string , expectedUrl : PartialUrl ) {
795
+ function verifyUrl ( urlString : string , expectedUrl : PartialUrl ) : void {
796
796
const url = parse ( urlString )
797
- if ( expectedUrl . scheme ) {
797
+ if ( expectedUrl . scheme != null ) {
798
798
expect ( url . scheme ) . toEqual ( expectedUrl . scheme )
799
799
} else {
800
800
expect ( url . scheme ) . toBeNull ( )
@@ -804,36 +804,40 @@ describe('#unit url-util', () => {
804
804
expect ( url . host ) . not . toBeNull ( )
805
805
expect ( url . host ) . toEqual ( expectedUrl . host )
806
806
807
- if ( expectedUrl . port ) {
807
+ if ( expectedUrl . port != null ) {
808
808
expect ( url . port ) . toEqual ( expectedUrl . port )
809
809
} else {
810
810
expect ( url . port ) . toEqual (
811
- urlUtil . defaultPortForScheme ( expectedUrl . scheme ! ! )
811
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
812
+ urlUtil . defaultPortForScheme ( expectedUrl . scheme ! )
812
813
)
813
814
}
814
815
815
816
verifyHostAndPort ( url , expectedUrl )
816
- if ( expectedUrl . query ) {
817
+ if ( expectedUrl . query != null ) {
817
818
expect ( url . query ) . toEqual ( expectedUrl . query )
818
819
} else {
819
820
expect ( url . query ) . toEqual ( { } )
820
821
}
821
822
}
822
823
823
- function verifyHostAndPort ( url : urlUtil . Url , expectedUrl : PartialUrl ) {
824
+ function verifyHostAndPort ( url : urlUtil . Url , expectedUrl : PartialUrl ) : void {
824
825
const port =
825
- expectedUrl . port === 0 || expectedUrl . port
826
+ expectedUrl . port === 0 || expectedUrl . port != null
826
827
? expectedUrl . port
827
- : urlUtil . defaultPortForScheme ( expectedUrl . scheme ! ! )
828
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
829
+ : urlUtil . defaultPortForScheme ( expectedUrl . scheme ! )
828
830
829
- if ( expectedUrl . ipv6 ) {
831
+ if ( expectedUrl . ipv6 != null ) {
832
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
830
833
expect ( url . hostAndPort ) . toEqual ( `[${ expectedUrl . host } ]:${ port } ` )
831
834
} else {
835
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
832
836
expect ( url . hostAndPort ) . toEqual ( `${ expectedUrl . host } :${ port } ` )
833
837
}
834
838
}
835
839
836
- function parse ( url : any ) : urlUtil . Url {
840
+ function parse ( url : any ) : urlUtil . Url {
837
841
return urlUtil . parseDatabaseUrl ( url )
838
842
}
839
843
} )
0 commit comments