@@ -85,6 +85,34 @@ test('ws: scrape using Client.scrape static method', function (t) {
8585 clientScrapeStatic ( t , 'ws' )
8686} )
8787
88+ // Ensure the callback function gets called when an invalid url is passed
89+ function clientScrapeStaticInvalid ( t , serverType ) {
90+ var announceUrl = serverType + '://invalid.lol'
91+ if ( serverType === 'http' ) announceUrl += '/announce'
92+
93+ var client = Client . scrape ( {
94+ announce : announceUrl ,
95+ infoHash : fixtures . leaves . parsedTorrent . infoHash ,
96+ wrtc : { }
97+ } , function ( err , data ) {
98+ t . ok ( err instanceof Error )
99+ t . end ( )
100+ } )
101+ if ( serverType === 'ws' ) common . mockWebsocketTracker ( client )
102+ }
103+
104+ test . only ( 'http: scrape using Client.scrape static method (invalid url)' , function ( t ) {
105+ clientScrapeStaticInvalid ( t , 'http' )
106+ } )
107+
108+ test ( 'udp: scrape using Client.scrape static method (invalid url)' , function ( t ) {
109+ clientScrapeStaticInvalid ( t , 'udp' )
110+ } )
111+
112+ test ( 'ws: scrape using Client.scrape static method (invalid url)' , function ( t ) {
113+ clientScrapeStaticInvalid ( t , 'ws' )
114+ } )
115+
88116function clientScrapeMulti ( t , serverType ) {
89117 var infoHash1 = fixtures . leaves . parsedTorrent . infoHash
90118 var infoHash2 = fixtures . alice . parsedTorrent . infoHash
0 commit comments