@@ -79,85 +79,85 @@ describe('resolveMongodbSrv', () => {
7979 } ) ;
8080
8181 it ( 'rejects when the TXT lookup rejects with a fatal error' , async ( ) => {
82- srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
82+ srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
8383 txtError = Object . assign ( new Error ( ) , { code : 'ENOENT' } ) ;
8484 assert . rejects ( resolveMongodbSrv ( 'mongodb+srv://server.example.com' , { dns } ) ) ;
8585 } ) ;
8686
8787 it ( 'does not reject when the TXT lookup results in ENOTFOUND' , async ( ) => {
88- srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
88+ srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
8989 txtError = Object . assign ( new Error ( ) , { code : 'ENOTFOUND' } ) ;
9090 assert . strictEqual (
9191 await resolveMongodbSrv ( 'mongodb+srv://server.example.com' , { dns } ) ,
9292 'mongodb://asdf.example.com/?tls=true' ) ;
9393 } ) ;
9494
9595 it ( 'does not reject when the TXT lookup results in a generic error' , async ( ) => {
96- srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
96+ srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
9797 txtError = new Error ( ) ;
9898 assert . strictEqual (
9999 await resolveMongodbSrv ( 'mongodb+srv://server.example.com' , { dns } ) ,
100100 'mongodb://asdf.example.com/?tls=true' ) ;
101101 } ) ;
102102
103103 it ( 'rejects when the TXT lookup returns more than one result' , async ( ) => {
104- srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
105- txtResult = [ [ 'a' ] , [ 'b' ] ] ;
104+ srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
105+ txtResult = [ [ 'a' ] , [ 'b' ] ] ;
106106 assert . rejects ( resolveMongodbSrv ( 'mongodb+srv://server.example.com' , { dns } ) ) ;
107107 } ) ;
108108
109109 it ( 'rejects when the TXT lookup returns invalid connection string options' , async ( ) => {
110- srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
111- txtResult = [ [ 'a=b' ] ] ;
110+ srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
111+ txtResult = [ [ 'a=b' ] ] ;
112112 assert . rejects ( resolveMongodbSrv ( 'mongodb+srv://server.example.com' , { dns } ) ) ;
113113 } ) ;
114114
115115 it ( 'accepts TXT lookup authSource' , async ( ) => {
116- srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
117- txtResult = [ [ 'authSource=admin' ] ] ;
116+ srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
117+ txtResult = [ [ 'authSource=admin' ] ] ;
118118 assert . strictEqual (
119119 await resolveMongodbSrv ( 'mongodb+srv://server.example.com' , { dns } ) ,
120120 'mongodb://asdf.example.com/?authSource=admin&tls=true' ) ;
121121 } ) ;
122122
123123 it ( 'rejects empty TXT lookup authSource' , async ( ) => {
124- srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
125- txtResult = [ [ 'authSource=' ] ] ;
124+ srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
125+ txtResult = [ [ 'authSource=' ] ] ;
126126 assert . rejects ( resolveMongodbSrv ( 'mongodb+srv://server.example.com' , { dns } ) ) ;
127127 } ) ;
128128
129129 it ( 'prioritizes URL-provided over TXT lookup authSource' , async ( ) => {
130- srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
131- txtResult = [ [ 'authSource=admin' ] ] ;
130+ srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
131+ txtResult = [ [ 'authSource=admin' ] ] ;
132132 assert . strictEqual (
133133 await resolveMongodbSrv ( 'mongodb+srv://server.example.com/?authSource=test' , { dns } ) ,
134134 'mongodb://asdf.example.com/?authSource=test&tls=true' ) ;
135135 } ) ;
136136
137137 it ( 'accepts TXT lookup replicaSet' , async ( ) => {
138- srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
139- txtResult = [ [ 'replicaSet=foo' ] ] ;
138+ srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
139+ txtResult = [ [ 'replicaSet=foo' ] ] ;
140140 assert . strictEqual (
141141 await resolveMongodbSrv ( 'mongodb+srv://server.example.com' , { dns } ) ,
142142 'mongodb://asdf.example.com/?replicaSet=foo&tls=true' ) ;
143143 } ) ;
144144
145145 it ( 'rejects empty TXT lookup replicaSet' , async ( ) => {
146- srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
147- txtResult = [ [ 'replicaSet=' ] ] ;
146+ srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
147+ txtResult = [ [ 'replicaSet=' ] ] ;
148148 assert . rejects ( resolveMongodbSrv ( 'mongodb+srv://server.example.com' , { dns } ) ) ;
149149 } ) ;
150150
151151 it ( 'prioritizes URL-provided over TXT lookup replicaSet' , async ( ) => {
152- srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
153- txtResult = [ [ 'replicaSet=foo' ] ] ;
152+ srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
153+ txtResult = [ [ 'replicaSet=foo' ] ] ;
154154 assert . strictEqual (
155155 await resolveMongodbSrv ( 'mongodb+srv://server.example.com/?replicaSet=bar' , { dns } ) ,
156156 'mongodb://asdf.example.com/?replicaSet=bar&tls=true' ) ;
157157 } ) ;
158158
159159 it ( 'prioritizes URL-provided tls over srv implication' , async ( ) => {
160- srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
160+ srvResult = [ { name : 'asdf.example.com' , port : 27017 } ] ;
161161 assert . strictEqual (
162162 await resolveMongodbSrv ( 'mongodb+srv://server.example.com/?tls=false' , { dns } ) ,
163163 'mongodb://asdf.example.com/?tls=false' ) ;
0 commit comments