Skip to content

Commit b1342c7

Browse files
committed
Add more pool cache tests
1 parent 2775551 commit b1342c7

File tree

2 files changed

+123
-1
lines changed

2 files changed

+123
-1
lines changed

test/list.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,15 @@ Overview of node-oracledb functional tests
817817
67.2.4 throws an error if an attempt is made to use a poolAlias for a pool that is not in the cache
818818
67.2.5 gets a connection from the default pool, even after an aliased pool is created
819819
67.2.6 uses the right pool, even after multiple pools are created
820+
67.3 poolAlias attribute
821+
67.3.1 throws an error if poolAttrs.poolAlias is an object
822+
67.3.2 throws an error if poolAttrs.poolAlias is an array
823+
67.3.3 throws an error if poolAttrs.poolAlias is a number
824+
67.3.4 throws an error if poolAttrs.poolAlias is a boolean
825+
67.3.5 throws an error if poolAttrs.poolAlias is null
826+
67.3.6 throws an error if poolAttrs.poolAlias is an empty string
827+
67.3.7 throws an error if poolAttrs.poolAlias is NaN
828+
67.3.8 works if poolAttrs.poolAlias is undefined
820829

821830
68. multipleLobInsertion.js
822831
68.1 inserts multiple BLOBs

test/poolCache.js

Lines changed: 114 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,5 +518,118 @@ describe('67. poolCache.js', function() {
518518
});
519519
});
520520
});
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
522635
});

0 commit comments

Comments
 (0)