Skip to content

Commit 47d49b4

Browse files
committed
Update tests
1 parent c2980cb commit 47d49b4

File tree

2 files changed

+119
-110
lines changed

2 files changed

+119
-110
lines changed

test/list.txt

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3619,7 +3619,7 @@ Overview of node-oracledb functional tests
36193619
139.1 columns fetched from REF CURSORS can be mapped by fetchInfo settings
36203620
139.2 fetchAsString takes effect as well
36213621

3622-
140. v8Getter.js
3622+
140. v8Getter.js
36233623
140.1 Negative: overwrite the getter() function of bind in objects
36243624
140.1.1 ProcessBindsByName()
36253625
140.1.2 ProcessBindsByPos()
@@ -3631,6 +3631,27 @@ Overview of node-oracledb functional tests
36313631
140.4 Negative: fetchInfo
36323632
140.4.1 changes getter() of fetchInfo itself
36333633
140.4.2 changes getter() of the value of fetchInfo object
3634+
140.5 Negative: Bool type
3635+
140.5.1 option - autoCommit
3636+
140.5.2 option - extendedMetaData
3637+
140.6 Negative: positive Int type
3638+
140.6.1 option - fetchArraySize
3639+
140.7 Negative: Pool object
3640+
140.7.1 String type - user
3641+
140.7.2 String type - password
3642+
140.7.3 String type - connectString
3643+
140.7.4 poolMin
3644+
140.7.5 poolMax
3645+
140.7.6 poolIncrement
3646+
140.7.7 poolTimeout
3647+
140.7.8 poolPingInterval
3648+
140.7.9 stmtCacheSize
3649+
140.7.10 connecionsOpen
3650+
140.7.11 connecionsInUse
3651+
140.8 Negative: Get Connection
3652+
140.8.1 String type: user
3653+
140.8.2 String type: password
3654+
140.8.3 String type: connectionString
36343655

36353656
141. insertNaNToNumber.js
36363657
141.1 SQL, stores NaN

test/v8Getter.js

Lines changed: 97 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -493,19 +493,30 @@ describe('140. v8Getter.js', function() {
493493
describe('140.7 Negative: Pool object', function() {
494494

495495
var dotest = function(opt, cb) {
496-
oracledb.createPool(
497-
opt,
498-
function(err, pool) {
499-
should.exist(err);
500-
should.not.exist(pool);
501-
cb();
502-
}
496+
497+
should.throws(
498+
function() {
499+
oracledb.createPool(
500+
opt,
501+
function(err, pool) {
502+
should.not.exist(err);
503+
should.exist(pool);
504+
505+
pool.close(function(err) {
506+
507+
should.not.exist(err);
508+
cb();
509+
});
510+
}
511+
);
512+
},
513+
/Nope/
503514
);
504515
};
505516

506-
it.skip('140.7.1 String type - user', function(done) {
517+
it('140.7.1 String type - user', function(done) {
507518

508-
var cred = dbConfig;
519+
var cred = JSON.parse(JSON.stringify(dbConfig));
509520
Object.defineProperty(cred, 'user', {
510521
get: function() {
511522
throw 'Nope';
@@ -514,9 +525,9 @@ describe('140. v8Getter.js', function() {
514525
dotest(cred, done);
515526
});
516527

517-
it.skip('140.7.2 String type - password', function(done) {
528+
it('140.7.2 String type - password', function(done) {
518529

519-
var cred = dbConfig;
530+
var cred = JSON.parse(JSON.stringify(dbConfig));
520531
Object.defineProperty(cred, 'password', {
521532
get: function() {
522533
throw 'Nope';
@@ -525,9 +536,9 @@ describe('140. v8Getter.js', function() {
525536
dotest(cred, done);
526537
});
527538

528-
it.skip('140.7.3 String type - connectString', function(done) {
539+
it('140.7.3 String type - connectString', function(done) {
529540

530-
var cred = dbConfig;
541+
var cred = JSON.parse(JSON.stringify(dbConfig));
531542
Object.defineProperty(cred, 'connectString', {
532543
get: function() {
533544
throw 'Nope';
@@ -536,9 +547,9 @@ describe('140. v8Getter.js', function() {
536547
dotest(cred, done);
537548
});
538549

539-
it.skip('140.7.4 poolMin', function(done) {
550+
it('140.7.4 poolMin', function(done) {
540551

541-
var cred = dbConfig;
552+
var cred = JSON.parse(JSON.stringify(dbConfig));
542553
Object.defineProperty(cred, 'poolMin', {
543554
get: function() {
544555
throw 'Nope';
@@ -547,9 +558,9 @@ describe('140. v8Getter.js', function() {
547558
dotest(cred, done);
548559
});
549560

550-
it.skip('140.7.5 poolMax', function(done) {
561+
it('140.7.5 poolMax', function(done) {
551562

552-
var cred = dbConfig;
563+
var cred = JSON.parse(JSON.stringify(dbConfig));
553564
Object.defineProperty(cred, 'poolMax', {
554565
get: function() {
555566
throw 'Nope';
@@ -558,9 +569,9 @@ describe('140. v8Getter.js', function() {
558569
dotest(cred, done);
559570
});
560571

561-
it.skip('140.7.6 poolIncrement', function(done) {
572+
it('140.7.6 poolIncrement', function(done) {
562573

563-
var cred = dbConfig;
574+
var cred = JSON.parse(JSON.stringify(dbConfig));
564575
Object.defineProperty(cred, 'poolIncrement', {
565576
get: function() {
566577
throw 'Nope';
@@ -569,9 +580,9 @@ describe('140. v8Getter.js', function() {
569580
dotest(cred, done);
570581
});
571582

572-
it.skip('140.7.7 poolTimeout', function(done) {
583+
it('140.7.7 poolTimeout', function(done) {
573584

574-
var cred = dbConfig;
585+
var cred = JSON.parse(JSON.stringify(dbConfig));
575586
Object.defineProperty(cred, 'poolTimeout', {
576587
get: function() {
577588
throw 'Nope';
@@ -580,9 +591,9 @@ describe('140. v8Getter.js', function() {
580591
dotest(cred, done);
581592
});
582593

583-
it.skip('140.7.8 poolPingInterval', function(done) {
594+
it('140.7.8 poolPingInterval', function(done) {
584595

585-
var cred = dbConfig;
596+
var cred = JSON.parse(JSON.stringify(dbConfig));
586597
Object.defineProperty(cred, 'poolPingInterval', {
587598
get: function() {
588599
throw 'Nope';
@@ -592,31 +603,9 @@ describe('140. v8Getter.js', function() {
592603
dotest(cred, done);
593604
});
594605

595-
it.skip('140.7.9 queueRequests', function(done) {
596-
597-
var cred = dbConfig;
598-
Object.defineProperty(cred, 'queueRequests', {
599-
get: function() {
600-
throw 'Nope';
601-
}
602-
});
603-
dotest(cred, done);
604-
});
605-
606-
it.skip('140.7.10 stmtCacheSize', function(done) {
607-
608-
var cred = dbConfig;
609-
Object.defineProperty(cred, 'stmtCacheSize', {
610-
get: function() {
611-
throw 'Nope';
612-
}
613-
});
614-
dotest(cred, done);
615-
});
616-
617-
it.skip('140.7.11 stmtCacheSize', function(done) {
606+
it('140.7.9 stmtCacheSize', function(done) {
618607

619-
var cred = dbConfig;
608+
var cred = JSON.parse(JSON.stringify(dbConfig));
620609
Object.defineProperty(cred, 'stmtCacheSize', {
621610
get: function() {
622611
throw 'Nope';
@@ -625,29 +614,7 @@ describe('140. v8Getter.js', function() {
625614
dotest(cred, done);
626615
});
627616

628-
it.skip('140.7.12 poolAlias', function(done) {
629-
630-
var cred = dbConfig;
631-
Object.defineProperty(cred, 'poolAlias', {
632-
get: function() {
633-
throw 'Nope';
634-
}
635-
});
636-
dotest(cred, done);
637-
});
638-
639-
it.skip('140.7.13 queueTimeout', function(done) {
640-
641-
var cred = dbConfig;
642-
Object.defineProperty(cred, 'queueTimeout', {
643-
get: function() {
644-
throw 'Nope';
645-
}
646-
});
647-
dotest(cred, done);
648-
});
649-
650-
it.skip('140.7.14 connecionsOpen', function(done) {
617+
it('140.7.10 connecionsOpen', function(done) {
651618

652619
oracledb.createPool(
653620
dbConfig,
@@ -656,20 +623,26 @@ describe('140. v8Getter.js', function() {
656623

657624
Object.defineProperty(pool, 'connecionsOpen', {
658625
get: function() {
659-
throw 'Nope';
626+
throw 'Property Wrong';
660627
}
661628
});
662-
console.log(pool.connecionsOpen);
663629

664-
pool.Close(function(err) {
630+
should.throws(
631+
function() {
632+
console.log(pool.connecionsOpen);
633+
},
634+
/Property Wrong/
635+
);
636+
637+
pool.close(function(err) {
665638
should.not.exist(err);
666639
done();
667640
});
668641
}
669642
);
670643
});
671644

672-
it.skip('140.7.15 connecionsInUse', function(done) {
645+
it('140.7.11 connecionsInUse', function(done) {
673646

674647
oracledb.createPool(
675648
dbConfig,
@@ -678,12 +651,17 @@ describe('140. v8Getter.js', function() {
678651

679652
Object.defineProperty(pool, 'connecionsInUse', {
680653
get: function() {
681-
throw 'Nope';
654+
throw 'Property Wrong';
682655
}
683656
});
684-
console.log(pool.connecionsInUse);
657+
should.throws(
658+
function() {
659+
console.log(pool.connecionsInUse);
660+
},
661+
/Property Wrong/
662+
);
685663

686-
pool.Close(function(err) {
664+
pool.close(function(err) {
687665
should.not.exist(err);
688666
done();
689667
});
@@ -693,52 +671,62 @@ describe('140. v8Getter.js', function() {
693671

694672
}); // 140.7
695673

696-
describe ('140.8 Negative Connection object', function () {
697-
it.skip ( '140.8.1 String type: user', function(done) {
698-
var cred = dbConfig;
699-
Object.defineProperty ( cred, 'user', {
700-
get : function () { throw 'Nope'; } } );
674+
describe('140.8 Negative: Get Connection', function () {
675+
676+
it('140.8.1 String type: user', function(done) {
701677

702-
oracledb.getConnection (
703-
cred,
704-
function ( err, connection ) {
705-
should.exist ( err ) ;
706-
should.not.exist ( connection ) ;
678+
var cred = JSON.parse(JSON.stringify(dbConfig));
679+
Object.defineProperty (cred, 'user', {
680+
get : function () {
681+
throw 'Nope';
707682
}
683+
});
684+
685+
should.throws(
686+
function() {
687+
oracledb.getConnection(cred, function(){ });
688+
},
689+
/Nope/
708690
);
709-
done ();
691+
done();
710692
});
711693

712-
it.skip ( '140.8.2 String type: password', function(done) {
713-
var cred = dbConfig;
714-
Object.defineProperty ( cred, 'password', {
715-
get : function () { throw 'Nope'; } } );
694+
it('140.8.2 String type: password', function(done) {
716695

717-
oracledb.getConnection (
718-
cred,
719-
function ( err, connection ) {
720-
should.exist ( err ) ;
721-
should.not.exist ( connection ) ;
696+
var cred = JSON.parse(JSON.stringify(dbConfig));
697+
Object.defineProperty (cred, 'password', {
698+
get : function () {
699+
throw 'Nope';
722700
}
701+
});
702+
703+
should.throws(
704+
function() {
705+
oracledb.getConnection(cred, function(){ });
706+
},
707+
/Nope/
723708
);
724-
done ();
709+
done();
725710
});
726711

727-
it.skip ( '140.8.3 String type: connectionString', function(done) {
728-
var cred = dbConfig;
729-
Object.defineProperty ( cred, 'connectionString', {
730-
get : function () { throw 'Nope'; } } );
712+
it('140.8.3 String type: connectionString', function(done) {
731713

732-
oracledb.getConnection (
733-
cred,
734-
function ( err, connection ) {
735-
should.exist ( err ) ;
736-
should.not.exist ( connection ) ;
714+
var cred = JSON.parse(JSON.stringify(dbConfig));
715+
Object.defineProperty (cred, 'connectString', {
716+
get : function () {
717+
throw 'Nope';
737718
}
719+
});
720+
721+
should.throws(
722+
function() {
723+
oracledb.getConnection(cred, function(){ });
724+
},
725+
/Nope/
738726
);
739-
done ();
727+
done();
740728
});
741729

742-
});
730+
}); // 140.8
743731

744732
});

0 commit comments

Comments
 (0)