@@ -304,4 +304,154 @@ describe('Disposable Domains Module', () => {
304304 expect ( memoryIncrease ) . toBeLessThan ( MAX_MEMORY_INCREASE_MB * 1024 * 1024 ) ;
305305 } ) ;
306306 } ) ;
307+
308+ describe ( 'additional edge cases' , ( ) => {
309+ describe ( 'URL-encoded domains' , ( ) => {
310+ test ( 'should handle URL-encoded domains' , async ( ) => {
311+ expect ( await isDisposableDomain ( '10minutemail%2Ecom' ) ) . toBe ( false ) ;
312+ expect ( await isDisposableDomain ( 'guerrillamail%2Ecom' ) ) . toBe ( false ) ;
313+ expect ( await isDisposableDomain ( '10minutemail%2ecom' ) ) . toBe ( false ) ;
314+ expect ( await isDisposableDomain ( 'yopmail%2Efr' ) ) . toBe ( false ) ;
315+ } ) ;
316+ } ) ;
317+
318+ describe ( 'whitespace handling' , ( ) => {
319+ test ( 'should handle various whitespace characters' , async ( ) => {
320+ expect ( await isDisposableDomain ( ' 10minutemail.com' ) ) . toBe ( false ) ;
321+ expect ( await isDisposableDomain ( '10minutemail.com ' ) ) . toBe ( false ) ;
322+ expect ( await isDisposableDomain ( ' 10minutemail.com ' ) ) . toBe ( false ) ;
323+ expect ( await isDisposableDomain ( '\t10minutemail.com' ) ) . toBe ( false ) ;
324+ expect ( await isDisposableDomain ( '10minutemail.com\n' ) ) . toBe ( false ) ;
325+ expect ( await isDisposableDomain ( '\r\n10minutemail.com\r\n' ) ) . toBe (
326+ false
327+ ) ;
328+ } ) ;
329+
330+ test ( 'should handle trimmed domains correctly' , async ( ) => {
331+ expect ( await isDisposableDomain ( '10minutemail.com' . trim ( ) ) ) . toBe ( true ) ;
332+ expect ( await isDisposableDomain ( ' guerrillamail.com ' . trim ( ) ) ) . toBe (
333+ true
334+ ) ;
335+ } ) ;
336+ } ) ;
337+
338+ describe ( 'domains with port numbers' , ( ) => {
339+ test ( 'should return false for domains with port numbers' , async ( ) => {
340+ expect ( await isDisposableDomain ( '10minutemail.com:8080' ) ) . toBe ( false ) ;
341+ expect ( await isDisposableDomain ( 'guerrillamail.com:443' ) ) . toBe ( false ) ;
342+ expect ( await isDisposableDomain ( 'yopmail.com:25' ) ) . toBe ( false ) ;
343+ expect ( await isDisposableDomain ( 'tempmail.org:3000' ) ) . toBe ( false ) ;
344+ } ) ;
345+ } ) ;
346+
347+ describe ( 'email addresses vs domains' , ( ) => {
348+ test ( 'should return false for full email addresses' , async ( ) => {
349+ expect ( await isDisposableDomain ( '[email protected] ' ) ) . toBe ( false ) ; 350+ expect ( await isDisposableDomain ( '[email protected] ' ) ) . toBe ( false ) ; 351+ expect ( await isDisposableDomain ( '[email protected] ' ) ) . toBe ( false ) ; 352+ expect ( await isDisposableDomain ( '[email protected] ' ) ) . toBe ( 353+ false
354+ ) ;
355+ } ) ;
356+
357+ test ( 'should handle email-like strings without @ symbol' , async ( ) => {
358+ expect ( await isDisposableDomain ( 'user.10minutemail.com' ) ) . toBe ( false ) ;
359+ expect ( await isDisposableDomain ( 'test_guerrillamail.com' ) ) . toBe ( false ) ;
360+ } ) ;
361+ } ) ;
362+
363+ describe ( 'URLs and paths' , ( ) => {
364+ test ( 'should return false for domains with query parameters' , async ( ) => {
365+ expect ( await isDisposableDomain ( '10minutemail.com?param=value' ) ) . toBe (
366+ false
367+ ) ;
368+ expect (
369+ await isDisposableDomain ( 'guerrillamail.com?foo=bar&baz=qux' )
370+ ) . toBe ( false ) ;
371+ expect ( await isDisposableDomain ( 'yopmail.com?' ) ) . toBe ( false ) ;
372+ } ) ;
373+
374+ test ( 'should return false for domains with fragments' , async ( ) => {
375+ expect ( await isDisposableDomain ( '10minutemail.com#section' ) ) . toBe (
376+ false
377+ ) ;
378+ expect ( await isDisposableDomain ( 'yopmail.com#/inbox' ) ) . toBe ( false ) ;
379+ expect ( await isDisposableDomain ( 'tempmail.org#' ) ) . toBe ( false ) ;
380+ } ) ;
381+
382+ test ( 'should return false for domains with paths' , async ( ) => {
383+ expect ( await isDisposableDomain ( '10minutemail.com/path' ) ) . toBe ( false ) ;
384+ expect ( await isDisposableDomain ( 'guerrillamail.com/inbox/user' ) ) . toBe (
385+ false
386+ ) ;
387+ expect ( await isDisposableDomain ( 'yopmail.com/' ) ) . toBe ( false ) ;
388+ } ) ;
389+
390+ test ( 'should return false for URLs with protocols' , async ( ) => {
391+ expect ( await isDisposableDomain ( 'http://10minutemail.com' ) ) . toBe ( false ) ;
392+ expect ( await isDisposableDomain ( 'https://guerrillamail.com' ) ) . toBe (
393+ false
394+ ) ;
395+ expect ( await isDisposableDomain ( 'ftp://yopmail.com' ) ) . toBe ( false ) ;
396+ expect ( await isDisposableDomain ( 'mailto:[email protected] ' ) ) . toBe ( 397+ false
398+ ) ;
399+ } ) ;
400+ } ) ;
401+
402+ describe ( 'IP addresses and localhost' , ( ) => {
403+ test ( 'should return false for IPv4 addresses' , async ( ) => {
404+ expect ( await isDisposableDomain ( '192.168.1.1' ) ) . toBe ( false ) ;
405+ expect ( await isDisposableDomain ( '127.0.0.1' ) ) . toBe ( false ) ;
406+ expect ( await isDisposableDomain ( '8.8.8.8' ) ) . toBe ( false ) ;
407+ expect ( await isDisposableDomain ( '255.255.255.255' ) ) . toBe ( false ) ;
408+ } ) ;
409+
410+ test ( 'should return false for IPv6 addresses' , async ( ) => {
411+ expect ( await isDisposableDomain ( '[2001:db8::1]' ) ) . toBe ( false ) ;
412+ expect ( await isDisposableDomain ( '2001:db8::1' ) ) . toBe ( false ) ;
413+ expect ( await isDisposableDomain ( '::1' ) ) . toBe ( false ) ;
414+ expect ( await isDisposableDomain ( 'fe80::1' ) ) . toBe ( false ) ;
415+ } ) ;
416+
417+ test ( 'should return false for localhost variations' , async ( ) => {
418+ expect ( await isDisposableDomain ( 'localhost' ) ) . toBe ( false ) ;
419+ expect ( await isDisposableDomain ( 'localhost.localdomain' ) ) . toBe ( false ) ;
420+ expect ( await isDisposableDomain ( 'local.host' ) ) . toBe ( false ) ;
421+ } ) ;
422+ } ) ;
423+
424+ describe ( 'file paths' , ( ) => {
425+ test ( 'should return false for file paths' , async ( ) => {
426+ expect ( await isDisposableDomain ( 'file:///path/to/file' ) ) . toBe ( false ) ;
427+ expect ( await isDisposableDomain ( 'C:\\Users\\test.com' ) ) . toBe ( false ) ;
428+ expect ( await isDisposableDomain ( '/home/user/10minutemail.com' ) ) . toBe (
429+ false
430+ ) ;
431+ expect ( await isDisposableDomain ( '../10minutemail.com' ) ) . toBe ( false ) ;
432+ expect ( await isDisposableDomain ( './guerrillamail.com' ) ) . toBe ( false ) ;
433+ } ) ;
434+ } ) ;
435+
436+ describe ( 'mixed domain formats' , ( ) => {
437+ test ( 'should handle domains with extra suffixes' , async ( ) => {
438+ expect ( await isDisposableDomain ( '10minutemail.com.fake' ) ) . toBe ( false ) ;
439+ expect ( await isDisposableDomain ( 'prefix.10minutemail.com.suffix' ) ) . toBe (
440+ false
441+ ) ;
442+ expect ( await isDisposableDomain ( '10minutemail.com.com' ) ) . toBe ( false ) ;
443+ } ) ;
444+
445+ test ( 'should handle domains with numeric TLDs' , async ( ) => {
446+ expect ( await isDisposableDomain ( '10minutemail.123' ) ) . toBe ( false ) ;
447+ expect ( await isDisposableDomain ( 'test.456' ) ) . toBe ( false ) ;
448+ } ) ;
449+
450+ test ( 'should handle domains with special characters in unexpected places' , async ( ) => {
451+ expect ( await isDisposableDomain ( '10minutemail..com' ) ) . toBe ( false ) ;
452+ expect ( await isDisposableDomain ( '10minutemail-.com' ) ) . toBe ( false ) ;
453+ expect ( await isDisposableDomain ( '10minutemail_.com' ) ) . toBe ( false ) ;
454+ } ) ;
455+ } ) ;
456+ } ) ;
307457} ) ;
0 commit comments