Improve attribute validation

This commit is contained in:
Christopher Jones 2017-06-29 16:16:01 +10:00
parent c47d282c10
commit 7259f36bba
4 changed files with 19 additions and 19 deletions

View File

@ -563,7 +563,7 @@ NAN_SETTER(njsOracledb::SetExternalAuth)
{
njsOracledb *oracledb = (njsOracledb*) ValidateSetter(info);
if (oracledb)
oracledb->externalAuth = value->ToBoolean()->Value();
oracledb->SetPropBool(value, &oracledb->externalAuth, "externalAuth" );
}
@ -622,7 +622,7 @@ NAN_SETTER(njsOracledb::SetFetchAsString)
// make sure we have an array
if (!value->IsArray()) {
errMsg = njsMessages::Get(errEmptyArrayForFetchAs);
errMsg = njsMessages::Get(errInvalidPropertyValue, "fetchAsString");
Nan::ThrowError(errMsg.c_str());
return;
}
@ -679,7 +679,7 @@ NAN_SETTER(njsOracledb::SetFetchAsBuffer)
// make sure we have an array
if (!value->IsArray()) {
errMsg = njsMessages::Get(errEmptyArrayForFetchAs);
errMsg = njsMessages::Get(errInvalidPropertyValue, "fetchAsBuffer");
Nan::ThrowError(errMsg.c_str());
return;
}

View File

@ -300,7 +300,7 @@ describe('56. fetchAs.js', function() {
(oracledb.fetchAsString).should.eql([]);
});
it.skip('56.12 Negative - empty string', function() {
it('56.12 Negative - empty string', function() {
should.throws(
function() {
oracledb.fetchAsString = '';
@ -309,7 +309,7 @@ describe('56. fetchAs.js', function() {
);
});
it.skip('56.13 Negative - null', function() {
it('56.13 Negative - null', function() {
should.throws(
function() {
oracledb.fetchAsString = null;
@ -318,7 +318,7 @@ describe('56. fetchAs.js', function() {
);
});
it.skip('56.14 Negative - undefined', function() {
it('56.14 Negative - undefined', function() {
should.throws(
function() {
oracledb.fetchAsString = undefined;
@ -327,7 +327,7 @@ describe('56. fetchAs.js', function() {
);
});
it.skip('56.15 Negative - NaN', function() {
it('56.15 Negative - NaN', function() {
should.throws(
function() {
oracledb.fetchAsString = NaN;
@ -336,7 +336,7 @@ describe('56. fetchAs.js', function() {
);
});
it.skip('56.16 Negative - invalid type of value, number', function() {
it('56.16 Negative - invalid type of value, number', function() {
should.throws(
function() {
oracledb.fetchAsString = 10;
@ -345,7 +345,7 @@ describe('56. fetchAs.js', function() {
);
});
it.skip('56.17 Negative - invalid type of value, string', function() {
it('56.17 Negative - invalid type of value, string', function() {
should.throws(
function() {
oracledb.fetchAsString = 'abc';
@ -411,7 +411,7 @@ describe('56. fetchAs.js', function() {
);
});
it.skip('56.21 Negative - invalid type of value, Date', function() {
it('56.21 Negative - invalid type of value, Date', function() {
should.throws(
function() {
var dt = new Date ();
@ -421,7 +421,7 @@ describe('56. fetchAs.js', function() {
);
});
it.skip('56.22 Negative - invalid type of value, Buffer', function() {
it('56.22 Negative - invalid type of value, Buffer', function() {
should.throws(
function() {
var buf = assist.createBuffer ( 10 ) ; // arbitary sized buffer

View File

@ -331,7 +331,7 @@ describe('89. fetchBlobAsBuffer3.js', function() {
}); // 89.2.7
it.skip('89.2.8 negative null value for fetchAsBuffer', function(done) {
it('89.2.8 negative null value for fetchAsBuffer', function(done) {
should.throws(
function() {
oracledb.fetchAsBuffer = null;
@ -342,7 +342,7 @@ describe('89. fetchBlobAsBuffer3.js', function() {
}); // 89.2.8
it.skip('89.2.9 negative undefined value for fetchAsBuffer', function(done) {
it('89.2.9 negative undefined value for fetchAsBuffer', function(done) {
should.throws(
function() {
oracledb.fetchAsBuffer = undefined;
@ -353,7 +353,7 @@ describe('89. fetchBlobAsBuffer3.js', function() {
}); // 89.2.9
it.skip('89.2.10 negative numeric value for fetchAsBuffer', function(done) {
it('89.2.10 negative numeric value for fetchAsBuffer', function(done) {
should.throws(
function() {
oracledb.fetchAsBuffer = 89210;
@ -364,7 +364,7 @@ describe('89. fetchBlobAsBuffer3.js', function() {
}); // 89.2.10
it.skip('89.2.11 negative emtpy string value for fetchAsBuffer', function(done) {
it('89.2.11 negative emtpy string value for fetchAsBuffer', function(done) {
should.throws(
function() {
oracledb.fetchAsBuffer = ' ';
@ -375,7 +375,7 @@ describe('89. fetchBlobAsBuffer3.js', function() {
}); // 89.2.11
it.skip('89.2.12 negative arbitary string value for fetchAsBuffer', function(done) {
it('89.2.12 negative arbitary string value for fetchAsBuffer', function(done) {
should.throws(
function() {
oracledb.fetchAsBuffer = "89.2.12";
@ -386,7 +386,7 @@ describe('89. fetchBlobAsBuffer3.js', function() {
}); // 89.2.12
it.skip('89.2.13 negative date value for fetchAsBuffer', function(done) {
it('89.2.13 negative date value for fetchAsBuffer', function(done) {
should.throws(
function() {
var dt = new Date ();
@ -398,7 +398,7 @@ describe('89. fetchBlobAsBuffer3.js', function() {
}); // 89.2.13
it.skip('89.2.14 negative arbitary buffer value for fetchAsBuffer', function(done) {
it('89.2.14 negative arbitary buffer value for fetchAsBuffer', function(done) {
should.throws(
function() {
var buf = assist.createBuffer ( 10 ) ;

View File

@ -275,7 +275,7 @@ describe('58. properties.js', function() {
);
});
it.skip('58.1.23 Negative - externalAuth', function() {
it('58.1.23 Negative - externalAuth', function() {
should.throws(
function() {
oracledb.externalAuth = 2017;