From 47d49b47e821095f80085e5d20909a06ddb8a213 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Tue, 6 Feb 2018 13:55:21 +1100 Subject: [PATCH] Update tests --- test/list.txt | 23 +++++- test/v8Getter.js | 206 ++++++++++++++++++++++------------------------- 2 files changed, 119 insertions(+), 110 deletions(-) diff --git a/test/list.txt b/test/list.txt index 703cb116..c365295d 100644 --- a/test/list.txt +++ b/test/list.txt @@ -3619,7 +3619,7 @@ Overview of node-oracledb functional tests 139.1 columns fetched from REF CURSORS can be mapped by fetchInfo settings 139.2 fetchAsString takes effect as well -140. v8Getter.js + 140. v8Getter.js 140.1 Negative: overwrite the getter() function of bind in objects 140.1.1 ProcessBindsByName() 140.1.2 ProcessBindsByPos() @@ -3631,6 +3631,27 @@ Overview of node-oracledb functional tests 140.4 Negative: fetchInfo 140.4.1 changes getter() of fetchInfo itself 140.4.2 changes getter() of the value of fetchInfo object + 140.5 Negative: Bool type + 140.5.1 option - autoCommit + 140.5.2 option - extendedMetaData + 140.6 Negative: positive Int type + 140.6.1 option - fetchArraySize + 140.7 Negative: Pool object + 140.7.1 String type - user + 140.7.2 String type - password + 140.7.3 String type - connectString + 140.7.4 poolMin + 140.7.5 poolMax + 140.7.6 poolIncrement + 140.7.7 poolTimeout + 140.7.8 poolPingInterval + 140.7.9 stmtCacheSize + 140.7.10 connecionsOpen + 140.7.11 connecionsInUse + 140.8 Negative: Get Connection + 140.8.1 String type: user + 140.8.2 String type: password + 140.8.3 String type: connectionString 141. insertNaNToNumber.js 141.1 SQL, stores NaN diff --git a/test/v8Getter.js b/test/v8Getter.js index e5f6dd9f..de5c25d6 100644 --- a/test/v8Getter.js +++ b/test/v8Getter.js @@ -493,19 +493,30 @@ describe('140. v8Getter.js', function() { describe('140.7 Negative: Pool object', function() { var dotest = function(opt, cb) { - oracledb.createPool( - opt, - function(err, pool) { - should.exist(err); - should.not.exist(pool); - cb(); - } + + should.throws( + function() { + oracledb.createPool( + opt, + function(err, pool) { + should.not.exist(err); + should.exist(pool); + + pool.close(function(err) { + + should.not.exist(err); + cb(); + }); + } + ); + }, + /Nope/ ); }; - it.skip('140.7.1 String type - user', function(done) { + it('140.7.1 String type - user', function(done) { - var cred = dbConfig; + var cred = JSON.parse(JSON.stringify(dbConfig)); Object.defineProperty(cred, 'user', { get: function() { throw 'Nope'; @@ -514,9 +525,9 @@ describe('140. v8Getter.js', function() { dotest(cred, done); }); - it.skip('140.7.2 String type - password', function(done) { + it('140.7.2 String type - password', function(done) { - var cred = dbConfig; + var cred = JSON.parse(JSON.stringify(dbConfig)); Object.defineProperty(cred, 'password', { get: function() { throw 'Nope'; @@ -525,9 +536,9 @@ describe('140. v8Getter.js', function() { dotest(cred, done); }); - it.skip('140.7.3 String type - connectString', function(done) { + it('140.7.3 String type - connectString', function(done) { - var cred = dbConfig; + var cred = JSON.parse(JSON.stringify(dbConfig)); Object.defineProperty(cred, 'connectString', { get: function() { throw 'Nope'; @@ -536,9 +547,9 @@ describe('140. v8Getter.js', function() { dotest(cred, done); }); - it.skip('140.7.4 poolMin', function(done) { + it('140.7.4 poolMin', function(done) { - var cred = dbConfig; + var cred = JSON.parse(JSON.stringify(dbConfig)); Object.defineProperty(cred, 'poolMin', { get: function() { throw 'Nope'; @@ -547,9 +558,9 @@ describe('140. v8Getter.js', function() { dotest(cred, done); }); - it.skip('140.7.5 poolMax', function(done) { + it('140.7.5 poolMax', function(done) { - var cred = dbConfig; + var cred = JSON.parse(JSON.stringify(dbConfig)); Object.defineProperty(cred, 'poolMax', { get: function() { throw 'Nope'; @@ -558,9 +569,9 @@ describe('140. v8Getter.js', function() { dotest(cred, done); }); - it.skip('140.7.6 poolIncrement', function(done) { + it('140.7.6 poolIncrement', function(done) { - var cred = dbConfig; + var cred = JSON.parse(JSON.stringify(dbConfig)); Object.defineProperty(cred, 'poolIncrement', { get: function() { throw 'Nope'; @@ -569,9 +580,9 @@ describe('140. v8Getter.js', function() { dotest(cred, done); }); - it.skip('140.7.7 poolTimeout', function(done) { + it('140.7.7 poolTimeout', function(done) { - var cred = dbConfig; + var cred = JSON.parse(JSON.stringify(dbConfig)); Object.defineProperty(cred, 'poolTimeout', { get: function() { throw 'Nope'; @@ -580,9 +591,9 @@ describe('140. v8Getter.js', function() { dotest(cred, done); }); - it.skip('140.7.8 poolPingInterval', function(done) { + it('140.7.8 poolPingInterval', function(done) { - var cred = dbConfig; + var cred = JSON.parse(JSON.stringify(dbConfig)); Object.defineProperty(cred, 'poolPingInterval', { get: function() { throw 'Nope'; @@ -592,20 +603,9 @@ describe('140. v8Getter.js', function() { dotest(cred, done); }); - it.skip('140.7.9 queueRequests', function(done) { + it('140.7.9 stmtCacheSize', function(done) { - var cred = dbConfig; - Object.defineProperty(cred, 'queueRequests', { - get: function() { - throw 'Nope'; - } - }); - dotest(cred, done); - }); - - it.skip('140.7.10 stmtCacheSize', function(done) { - - var cred = dbConfig; + var cred = JSON.parse(JSON.stringify(dbConfig)); Object.defineProperty(cred, 'stmtCacheSize', { get: function() { throw 'Nope'; @@ -614,40 +614,7 @@ describe('140. v8Getter.js', function() { dotest(cred, done); }); - it.skip('140.7.11 stmtCacheSize', function(done) { - - var cred = dbConfig; - Object.defineProperty(cred, 'stmtCacheSize', { - get: function() { - throw 'Nope'; - } - }); - dotest(cred, done); - }); - - it.skip('140.7.12 poolAlias', function(done) { - - var cred = dbConfig; - Object.defineProperty(cred, 'poolAlias', { - get: function() { - throw 'Nope'; - } - }); - dotest(cred, done); - }); - - it.skip('140.7.13 queueTimeout', function(done) { - - var cred = dbConfig; - Object.defineProperty(cred, 'queueTimeout', { - get: function() { - throw 'Nope'; - } - }); - dotest(cred, done); - }); - - it.skip('140.7.14 connecionsOpen', function(done) { + it('140.7.10 connecionsOpen', function(done) { oracledb.createPool( dbConfig, @@ -656,12 +623,18 @@ describe('140. v8Getter.js', function() { Object.defineProperty(pool, 'connecionsOpen', { get: function() { - throw 'Nope'; + throw 'Property Wrong'; } }); - console.log(pool.connecionsOpen); - pool.Close(function(err) { + should.throws( + function() { + console.log(pool.connecionsOpen); + }, + /Property Wrong/ + ); + + pool.close(function(err) { should.not.exist(err); done(); }); @@ -669,7 +642,7 @@ describe('140. v8Getter.js', function() { ); }); - it.skip('140.7.15 connecionsInUse', function(done) { + it('140.7.11 connecionsInUse', function(done) { oracledb.createPool( dbConfig, @@ -678,12 +651,17 @@ describe('140. v8Getter.js', function() { Object.defineProperty(pool, 'connecionsInUse', { get: function() { - throw 'Nope'; + throw 'Property Wrong'; } }); - console.log(pool.connecionsInUse); + should.throws( + function() { + console.log(pool.connecionsInUse); + }, + /Property Wrong/ + ); - pool.Close(function(err) { + pool.close(function(err) { should.not.exist(err); done(); }); @@ -693,52 +671,62 @@ describe('140. v8Getter.js', function() { }); // 140.7 - describe ('140.8 Negative Connection object', function () { - it.skip ( '140.8.1 String type: user', function(done) { - var cred = dbConfig; - Object.defineProperty ( cred, 'user', { - get : function () { throw 'Nope'; } } ); + describe('140.8 Negative: Get Connection', function () { - oracledb.getConnection ( - cred, - function ( err, connection ) { - should.exist ( err ) ; - should.not.exist ( connection ) ; + it('140.8.1 String type: user', function(done) { + + var cred = JSON.parse(JSON.stringify(dbConfig)); + Object.defineProperty (cred, 'user', { + get : function () { + throw 'Nope'; } + }); + + should.throws( + function() { + oracledb.getConnection(cred, function(){ }); + }, + /Nope/ ); - done (); + done(); }); - it.skip ( '140.8.2 String type: password', function(done) { - var cred = dbConfig; - Object.defineProperty ( cred, 'password', { - get : function () { throw 'Nope'; } } ); + it('140.8.2 String type: password', function(done) { - oracledb.getConnection ( - cred, - function ( err, connection ) { - should.exist ( err ) ; - should.not.exist ( connection ) ; + var cred = JSON.parse(JSON.stringify(dbConfig)); + Object.defineProperty (cred, 'password', { + get : function () { + throw 'Nope'; } + }); + + should.throws( + function() { + oracledb.getConnection(cred, function(){ }); + }, + /Nope/ ); - done (); + done(); }); - it.skip ( '140.8.3 String type: connectionString', function(done) { - var cred = dbConfig; - Object.defineProperty ( cred, 'connectionString', { - get : function () { throw 'Nope'; } } ); + it('140.8.3 String type: connectionString', function(done) { - oracledb.getConnection ( - cred, - function ( err, connection ) { - should.exist ( err ) ; - should.not.exist ( connection ) ; + var cred = JSON.parse(JSON.stringify(dbConfig)); + Object.defineProperty (cred, 'connectString', { + get : function () { + throw 'Nope'; } + }); + + should.throws( + function() { + oracledb.getConnection(cred, function(){ }); + }, + /Nope/ ); - done (); + done(); }); - }); + }); // 140.8 });