@@ -657,60 +657,48 @@ describe('protocol module', () => {
657657 } )
658658
659659 describe ( 'protocol.isProtocolHandled' , ( ) => {
660- it ( 'returns true for about:' , ( done ) => {
661- protocol . isProtocolHandled ( 'about' , ( result ) => {
662- assert . strictEqual ( result , true )
663- done ( )
664- } )
660+ it ( 'returns true for about:' , async ( ) => {
661+ const result = await protocol . isProtocolHandled ( 'about' )
662+ assert . strictEqual ( result , true )
665663 } )
666664
667- it ( 'returns true for file:' , ( done ) => {
668- protocol . isProtocolHandled ( 'file' , ( result ) => {
669- assert . strictEqual ( result , true )
670- done ( )
671- } )
665+ it ( 'returns true for file:' , async ( ) => {
666+ const result = await protocol . isProtocolHandled ( 'file' )
667+ assert . strictEqual ( result , true )
672668 } )
673669
674- it ( 'returns true for http:' , ( done ) => {
675- protocol . isProtocolHandled ( 'http' , ( result ) => {
676- assert . strictEqual ( result , true )
677- done ( )
678- } )
670+ it ( 'returns true for http:' , async ( ) => {
671+ const result = await protocol . isProtocolHandled ( 'http' )
672+ assert . strictEqual ( result , true )
679673 } )
680674
681- it ( 'returns true for https:' , ( done ) => {
682- protocol . isProtocolHandled ( 'https' , ( result ) => {
683- assert . strictEqual ( result , true )
684- done ( )
685- } )
675+ it ( 'returns true for https:' , async ( ) => {
676+ const result = await protocol . isProtocolHandled ( 'https' )
677+ assert . strictEqual ( result , true )
686678 } )
687679
688- it ( 'returns false when scheme is not registered' , ( done ) => {
689- protocol . isProtocolHandled ( 'no-exist' , ( result ) => {
690- assert . strictEqual ( result , false )
691- done ( )
692- } )
680+ it ( 'returns false when scheme is not registered' , async ( ) => {
681+ const result = await protocol . isProtocolHandled ( 'no-exist' )
682+ assert . strictEqual ( result , false )
693683 } )
694684
695685 it ( 'returns true for custom protocol' , ( done ) => {
696686 const emptyHandler = ( request , callback ) => callback ( )
697- protocol . registerStringProtocol ( protocolName , emptyHandler , ( error ) => {
687+ protocol . registerStringProtocol ( protocolName , emptyHandler , async ( error ) => {
698688 assert . strictEqual ( error , null )
699- protocol . isProtocolHandled ( protocolName , ( result ) => {
700- assert . strictEqual ( result , true )
701- done ( )
702- } )
689+ const result = await protocol . isProtocolHandled ( protocolName )
690+ assert . strictEqual ( result , true )
691+ done ( )
703692 } )
704693 } )
705694
706695 it ( 'returns true for intercepted protocol' , ( done ) => {
707696 const emptyHandler = ( request , callback ) => callback ( )
708- protocol . interceptStringProtocol ( 'http' , emptyHandler , ( error ) => {
697+ protocol . interceptStringProtocol ( 'http' , emptyHandler , async ( error ) => {
709698 assert . strictEqual ( error , null )
710- protocol . isProtocolHandled ( 'http' , ( result ) => {
711- assert . strictEqual ( result , true )
712- done ( )
713- } )
699+ const result = await protocol . isProtocolHandled ( 'http' )
700+ assert . strictEqual ( result , true )
701+ done ( )
714702 } )
715703 } )
716704 } )
0 commit comments