@@ -49,41 +49,14 @@ export class ConnectionUnitTest {
4949 } ) ;
5050 }
5151
52- @test ( ' - Test options.uri' )
53- testOptionsUri ( ) {
54- const urisOk = [
55- 'amqp://localhost' ,
56- 'amqp://hello:world@localhost' ,
57- 'amqp://hello:world@localhost:98798' ,
58- 'amqp://hello:world@localhost:98798/vhost' ,
59- 'amqp://hello:world@localhost:98798/%2Fvhost' ,
60- 'amqp://hello:world@localhost:98798'
61- ] ;
62-
63- const urisNOk = [ 'not_good' , ' amqp://localhost' , 'amqp://xxx:zzzzz@' , 'amqp://xxx:zzzzz#/322d' ] ;
64-
65- urisOk . forEach ( uri => {
66- const instance = new ConnectionManager ( { uri } ) ;
67- unit . object ( instance ) . isInstanceOf ( ConnectionManager ) ;
68- } ) ;
69-
70- urisNOk . forEach ( uri => {
71- unit
72- . exception ( _ => {
73- unit . when ( 'Invalid uri' , new ConnectionManager ( { uri } ) ) ;
74- } )
75- . isInstanceOf ( Error )
76- . hasProperty ( 'message' , 'Invalid uri' ) ;
77- } ) ;
78- }
79-
8052 @test ( ' - Test options' )
8153 testOptions ( ) {
8254 const options = [
8355 [ { login : 'keyboard' , password : 'cat' } , 'amqp://keyboard:cat@localhost:5672' ] ,
8456 [ { retry : { maximum_attempts : 0 } } , 'amqp://localhost:5672' ] ,
8557 [ { params : { heartBeat : 30 } } , 'amqp://localhost:5672?heartBeat=30' ] ,
8658 [ { params : { heartBeat : 30 } , vhost : '/my_vhost' } , 'amqp://localhost:5672/%2Fmy_vhost?heartBeat=30' ] ,
59+ [ { uri : 'amqp://localhost:5672/%2Fmy_vhost?heartBeat=30' } , 'amqp://localhost:5672/%2Fmy_vhost?heartBeat=30' ] ,
8760 [ undefined , 'amqp://localhost:5672' ]
8861 ] ;
8962
0 commit comments