@@ -31,21 +31,19 @@ describe('DNS timeout errors', () => {
3131 await client . close ( ) ;
3232 } ) ;
3333
34- const restoreDNS =
35- api =>
36- async ( ...args ) => {
37- sinon . restore ( ) ;
38- return await dns . promises [ api ] ( ...args ) ;
39- } ;
34+ const restoreDNS = api => async args => {
35+ sinon . restore ( ) ;
36+ return await dns . promises . resolve ( args , api ) ;
37+ } ;
4038
4139 describe ( 'when SRV record look up times out' , ( ) => {
4240 beforeEach ( ( ) => {
4341 stub = sinon
44- . stub ( dns . promises , 'resolveSrv ' )
42+ . stub ( dns . promises , 'resolve ' )
4543 . onFirstCall ( )
4644 . rejects ( new DNSTimeoutError ( ) )
4745 . onSecondCall ( )
48- . callsFake ( restoreDNS ( 'resolveSrv ' ) ) ;
46+ . callsFake ( restoreDNS ( 'SRV ' ) ) ;
4947 } ) ;
5048
5149 afterEach ( async function ( ) {
@@ -61,11 +59,11 @@ describe('DNS timeout errors', () => {
6159 describe ( 'when TXT record look up times out' , ( ) => {
6260 beforeEach ( ( ) => {
6361 stub = sinon
64- . stub ( dns . promises , 'resolveTxt ' )
62+ . stub ( dns . promises , 'resolve ' )
6563 . onFirstCall ( )
6664 . rejects ( new DNSTimeoutError ( ) )
6765 . onSecondCall ( )
68- . callsFake ( restoreDNS ( 'resolveTxt ' ) ) ;
66+ . callsFake ( restoreDNS ( 'TXT ' ) ) ;
6967 } ) ;
7068
7169 afterEach ( async function ( ) {
@@ -81,7 +79,7 @@ describe('DNS timeout errors', () => {
8179 describe ( 'when SRV record look up times out twice' , ( ) => {
8280 beforeEach ( ( ) => {
8381 stub = sinon
84- . stub ( dns . promises , 'resolveSrv ' )
82+ . stub ( dns . promises , 'resolve ' )
8583 . onFirstCall ( )
8684 . rejects ( new DNSTimeoutError ( ) )
8785 . onSecondCall ( )
@@ -102,7 +100,7 @@ describe('DNS timeout errors', () => {
102100 describe ( 'when TXT record look up times out twice' , ( ) => {
103101 beforeEach ( ( ) => {
104102 stub = sinon
105- . stub ( dns . promises , 'resolveTxt ' )
103+ . stub ( dns . promises , 'resolve ' )
106104 . onFirstCall ( )
107105 . rejects ( new DNSTimeoutError ( ) )
108106 . onSecondCall ( )
@@ -123,11 +121,11 @@ describe('DNS timeout errors', () => {
123121 describe ( 'when SRV record look up throws a non-timeout error' , ( ) => {
124122 beforeEach ( ( ) => {
125123 stub = sinon
126- . stub ( dns . promises , 'resolveSrv ' )
124+ . stub ( dns . promises , 'resolve ' )
127125 . onFirstCall ( )
128126 . rejects ( new DNSSomethingError ( ) )
129127 . onSecondCall ( )
130- . callsFake ( restoreDNS ( 'resolveSrv ' ) ) ;
128+ . callsFake ( restoreDNS ( 'SRV ' ) ) ;
131129 } ) ;
132130
133131 afterEach ( async function ( ) {
@@ -144,11 +142,11 @@ describe('DNS timeout errors', () => {
144142 describe ( 'when TXT record look up throws a non-timeout error' , ( ) => {
145143 beforeEach ( ( ) => {
146144 stub = sinon
147- . stub ( dns . promises , 'resolveTxt ' )
145+ . stub ( dns . promises , 'resolve ' )
148146 . onFirstCall ( )
149147 . rejects ( new DNSSomethingError ( ) )
150148 . onSecondCall ( )
151- . callsFake ( restoreDNS ( 'resolveTxt ' ) ) ;
149+ . callsFake ( restoreDNS ( 'TXT ' ) ) ;
152150 } ) ;
153151
154152 afterEach ( async function ( ) {
0 commit comments