File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -25,18 +25,26 @@ import Pool from '../../src/v1/internal/pool';
2525describe ( 'RoutingDriver' , ( ) => {
2626
2727 it ( 'should create least connected when nothing configured' , ( ) => {
28- const strategy = RoutingDriver . _createLoadBalancingStrategy ( { } , new Pool ( ) ) ;
28+ const strategy = createStrategy ( { } ) ;
2929 expect ( strategy instanceof LeastConnectedLoadBalancingStrategy ) . toBeTruthy ( ) ;
3030 } ) ;
3131
3232 it ( 'should create least connected when it is configured' , ( ) => {
33- const strategy = RoutingDriver . _createLoadBalancingStrategy ( { loadBalancingStrategy : 'least_connected' } , new Pool ( ) ) ;
33+ const strategy = createStrategy ( { loadBalancingStrategy : 'least_connected' } ) ;
3434 expect ( strategy instanceof LeastConnectedLoadBalancingStrategy ) . toBeTruthy ( ) ;
3535 } ) ;
3636
3737 it ( 'should create round robin when it is configured' , ( ) => {
38- const strategy = RoutingDriver . _createLoadBalancingStrategy ( { loadBalancingStrategy : 'round_robin' } , new Pool ( ) ) ;
38+ const strategy = createStrategy ( { loadBalancingStrategy : 'round_robin' } ) ;
3939 expect ( strategy instanceof RoundRobinLoadBalancingStrategy ) . toBeTruthy ( ) ;
4040 } ) ;
4141
42+ it ( 'should fail when unknown strategy is configured' , ( ) => {
43+ expect ( ( ) => createStrategy ( { loadBalancingStrategy : 'wrong' } ) ) . toThrow ( ) ;
44+ } ) ;
45+
4246} ) ;
47+
48+ function createStrategy ( config ) {
49+ return RoutingDriver . _createLoadBalancingStrategy ( config , new Pool ( ) ) ;
50+ }
You can’t perform that action at this time.
0 commit comments