@@ -518,5 +518,118 @@ describe('67. poolCache.js', function() {
518
518
} ) ;
519
519
} ) ;
520
520
} ) ;
521
- } ) ;
521
+ } ) ; // 67.2
522
+
523
+ // This suite extends 67.1.6 case with various types
524
+ describe ( '67.3 poolAlias attribute' , function ( ) {
525
+
526
+ it ( '67.3.1 throws an error if poolAttrs.poolAlias is an object' , function ( done ) {
527
+
528
+ dbConfig . poolAlias = { 'foo' : 'bar' } ;
529
+
530
+ oracledb . createPool ( dbConfig , function ( err , pool ) {
531
+ should . exist ( err ) ;
532
+
533
+ ( err . message ) . should . startWith ( 'NJS-004:' ) ;
534
+
535
+ done ( ) ;
536
+ } ) ;
537
+ } ) ;
538
+
539
+ it ( '67.3.2 throws an error if poolAttrs.poolAlias is an array' , function ( done ) {
540
+
541
+ dbConfig . poolAlias = [ ] ;
542
+
543
+ oracledb . createPool ( dbConfig , function ( err , pool ) {
544
+ should . exist ( err ) ;
545
+
546
+ ( err . message ) . should . startWith ( 'NJS-004:' ) ;
547
+ // NJS-004: invalid value for property poolAttrs.poolAlias
548
+ done ( ) ;
549
+ } ) ;
550
+ } ) ;
551
+
552
+ it ( '67.3.3 throws an error if poolAttrs.poolAlias is a number' , function ( done ) {
553
+
554
+ dbConfig . poolAlias = 123 ;
555
+
556
+ oracledb . createPool ( dbConfig , function ( err , pool ) {
557
+ should . exist ( err ) ;
558
+
559
+ ( err . message ) . should . startWith ( 'NJS-004:' ) ;
560
+
561
+ done ( ) ;
562
+ } ) ;
563
+ } ) ;
564
+
565
+ it ( '67.3.4 throws an error if poolAttrs.poolAlias is a boolean' , function ( done ) {
566
+
567
+ dbConfig . poolAlias = false ;
568
+
569
+ oracledb . createPool ( dbConfig , function ( err , pool ) {
570
+ should . exist ( err ) ;
571
+
572
+ ( err . message ) . should . startWith ( 'NJS-004:' ) ;
573
+
574
+ done ( ) ;
575
+ } ) ;
576
+ } ) ;
577
+
578
+ it ( '67.3.5 throws an error if poolAttrs.poolAlias is null' , function ( done ) {
579
+
580
+ dbConfig . poolAlias = null ;
581
+
582
+ oracledb . createPool ( dbConfig , function ( err , pool ) {
583
+ should . exist ( err ) ;
584
+
585
+ ( err . message ) . should . startWith ( 'NJS-004:' ) ;
586
+
587
+ done ( ) ;
588
+ } ) ;
589
+ } ) ;
590
+
591
+ it ( '67.3.6 throws an error if poolAttrs.poolAlias is an empty string' , function ( done ) {
592
+
593
+ dbConfig . poolAlias = '' ;
594
+
595
+ oracledb . createPool ( dbConfig , function ( err , pool ) {
596
+ should . exist ( err ) ;
597
+
598
+ ( err . message ) . should . startWith ( 'NJS-004:' ) ;
599
+
600
+ done ( ) ;
601
+ } ) ;
602
+ } ) ;
603
+
604
+ it ( '67.3.7 throws an error if poolAttrs.poolAlias is NaN' , function ( done ) {
605
+
606
+ dbConfig . poolAlias = NaN ;
607
+
608
+ oracledb . createPool ( dbConfig , function ( err , pool ) {
609
+ should . exist ( err ) ;
610
+
611
+ ( err . message ) . should . startWith ( 'NJS-004:' ) ;
612
+
613
+ done ( ) ;
614
+ } ) ;
615
+ } ) ;
616
+
617
+ it ( '67.3.8 works if poolAttrs.poolAlias is undefined' , function ( done ) {
618
+
619
+ dbConfig . poolAlias = undefined ;
620
+
621
+ oracledb . createPool ( dbConfig , function ( err , pool ) {
622
+
623
+ pool . should . be . ok ( ) ;
624
+ ( pool . poolAlias ) . should . equal ( 'default' ) ;
625
+
626
+ pool . close ( function ( err ) {
627
+ should . not . exist ( err ) ;
628
+ done ( ) ;
629
+ } ) ;
630
+
631
+ } ) ;
632
+ } ) ;
633
+
634
+ } ) ; // 67.3
522
635
} ) ;
0 commit comments