Skip to content

Commit 14f7a32

Browse files
committed
Make error.message.should.startWith usage consistent for NJS errors in tests
1 parent ecb63f6 commit 14f7a32

18 files changed

+110
-87
lines changed

test/accessTerminatedPoolAttributes.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ describe('51. accessTerminatedPoolAttributes.js', function(){
7474
}
7575
catch(err){
7676
should.exist(err);
77-
(err.message).should.eql('NJS-002: invalid pool');
77+
(err.message).should.startWith('NJS-002:');
78+
// NJS-002: invalid pool
7879
}
7980
done();
8081
});

test/binding.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,7 @@ describe('4. binding.js', function() {
733733
it('4.5.1 ',function(done) {
734734
connection.execute(
735735
"insert into nodb_raw (num) values (:id)",
736-
{ id: { val: 1, type: oracledb.NUMBER } }, // fails with error NJS-013: invalid bind direction
737-
// { id: { val: 1, type: oracledb.NUMBER, dir: oracledb.BIND_IN } }, // works
736+
{ id: { val: 1, type: oracledb.NUMBER } },
738737
function(err, result) {
739738
should.not.exist(err);
740739
done();

test/connection.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
* 51 - are for other tests
3232
*
3333
*****************************************************************************/
34+
'use strict';
3435

3536
var oracledb = require('oracledb');
3637
var should = require('should');
@@ -141,7 +142,8 @@ describe('1. connection.js', function(){
141142
query, {id: 20}, {outFormat:0 },
142143
function(err, result){
143144
should.exist(err);
144-
(err.message).should.equal('NJS-004: invalid value for property outFormat');
145+
(err.message).should.startWith('NJS-004:');
146+
// NJS-004: invalid value for property outFormat
145147
done();
146148
}
147149
);
@@ -249,7 +251,8 @@ describe('1. connection.js', function(){
249251
{}, { maxRows: 0 },
250252
function(err, result){
251253
should.exist(err);
252-
err.message.should.startWith('NJS-026:'); // NJS-026: maxRows must be greater than zero
254+
(err.message).should.startWith('NJS-026:');
255+
// NJS-026: maxRows must be greater than zero
253256
done();
254257
}
255258
);
@@ -262,7 +265,7 @@ describe('1. connection.js', function(){
262265
{}, {maxRows: -5},
263266
function(err, result){
264267
should.exist(err);
265-
(err.message).should.startWith('NJS-007: invalid value for');
268+
(err.message).should.startWith('NJS-007:');
266269
done();
267270
}
268271
);

test/dataTypeRaw.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ describe('42. dataTypeRaw.js', function() {
174174
{ autoCommit: true },
175175
function(err, result) {
176176
should.exist(err);
177-
(err.message).should.startWith('NJS-028');
177+
(err.message).should.startWith('NJS-028:');
178178
// NJS-028: raw database type is not supported with DML Returning statements
179179
done();
180180
}
@@ -197,7 +197,7 @@ describe('42. dataTypeRaw.js', function() {
197197
{ autoCommit: true },
198198
function(err, result) {
199199
should.exist(err);
200-
(err.message).should.startWith('NJS-028');
200+
(err.message).should.startWith('NJS-028:');
201201
done();
202202
}
203203
);
@@ -219,7 +219,7 @@ describe('42. dataTypeRaw.js', function() {
219219
{ autoCommit: true },
220220
function(err, result) {
221221
should.exist(err);
222-
(err.message).should.startWith('NJS-028');
222+
(err.message).should.startWith('NJS-028:');
223223
done();
224224
}
225225
);
@@ -241,7 +241,7 @@ describe('42. dataTypeRaw.js', function() {
241241
{ autoCommit: true },
242242
function(err, result) {
243243
should.exist(err);
244-
(err.message).should.startWith('NJS-028');
244+
(err.message).should.startWith('NJS-028:');
245245
done();
246246
}
247247
);
@@ -260,7 +260,7 @@ describe('42. dataTypeRaw.js', function() {
260260
{ autoCommit: true },
261261
function(err, result) {
262262
should.exist(err);
263-
(err.message).should.startWith('NJS-028');
263+
(err.message).should.startWith('NJS-028:');
264264
done();
265265
}
266266
);
@@ -279,7 +279,7 @@ describe('42. dataTypeRaw.js', function() {
279279
{ autoCommit: true },
280280
function(err, result) {
281281
should.exist(err);
282-
(err.message).should.startWith('NJS-028');
282+
(err.message).should.startWith('NJS-028:');
283283
done();
284284
}
285285
);

test/dataTypeRowid.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ describe('39. dataTypeRowid.js', function() {
104104
"SELECT * FROM " + tableName,
105105
function(err, result) {
106106
should.exist(err);
107-
err.message.should.startWith('NJS-010:'); // unsupported data type in select list
107+
(err.message).should.startWith('NJS-010:');
108+
// unsupported data type in select list
108109
done();
109110
}
110111
);

test/dataTypeTimestamp3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ describe('35. dataTypeTimestamp3.js', function() {
121121
{ outFormat: oracledb.OBJECT },
122122
function(err, result) {
123123
should.exist(err);
124-
err.message.should.startWith('NJS-010:'); // unsupported data type in select list
124+
(err.message).should.startWith('NJS-010:'); // unsupported data type in select list
125125

126126
done();
127127
}

test/dataTypeTimestamp4.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ describe('36. dataTypeTimestamp4.js', function() {
121121
{ outFormat: oracledb.OBJECT },
122122
function(err, result) {
123123
should.exist(err);
124-
err.message.should.startWith('NJS-010:'); // unsupported data type in select list
124+
(err.message).should.startWith('NJS-010:'); // unsupported data type in select list
125125
/*
126126
console.log(result);
127127
for(var j = 0; j < timestamps.length; j++)

test/dmlReturning.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ describe('6. dmlReturning.js', function(){
159159
{ autoCommit: true },
160160
function(err, result) {
161161
should.exist(err);
162-
err.message.should.startWith('NJS-016'); // NJS-016: buffer is too small for OUT binds
162+
err.message.should.startWith('NJS-016:');
163+
// NJS-016: buffer is too small for OUT binds
163164
//console.log(result);
164165
done();
165166
}
@@ -374,7 +375,7 @@ describe('6. dmlReturning.js', function(){
374375
connection.execute(sql, bindVar, function(err, result) {
375376
should.exist(err);
376377
// NJS-028: raw database type is not supported with DML Returning statements
377-
(err.message).should.startWith('NJS-028: ');
378+
(err.message).should.startWith('NJS-028:');
378379
done();
379380
});
380381

test/fetchAs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ describe('56. fetchAs.js', function() {
288288
{ fetchInfo : { "THE_DATE" : oracledb.STRING }},
289289
function ( err, result ) {
290290
should.exist ( err ) ;
291-
err.message.should.startWith ('NJS-015:');
291+
(err.message).should.startWith ('NJS-015:');
292292
done ();
293293
} );
294294
});

test/lobProperties.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ describe('62. lobProperties.js', function() {
368368
clob.pieceSize = -100;
369369
} catch(err) {
370370
should.exist(err);
371-
(err.message).should.startWith('NJS-004');
371+
(err.message).should.startWith('NJS-004:');
372372
// NJS-004: invalid value for property pieceSize
373373
}
374374

@@ -394,7 +394,7 @@ describe('62. lobProperties.js', function() {
394394
clob.pieceSize = null;
395395
} catch(err) {
396396
should.exist(err);
397-
(err.message).should.startWith('NJS-004');
397+
(err.message).should.startWith('NJS-004:');
398398
// NJS-004: invalid value for property pieceSize
399399
}
400400

@@ -420,7 +420,7 @@ describe('62. lobProperties.js', function() {
420420
clob.pieceSize = NaN;
421421
} catch(err) {
422422
should.exist(err);
423-
(err.message).should.startWith('NJS-004');
423+
(err.message).should.startWith('NJS-004:');
424424
// NJS-004: invalid value for property pieceSize
425425
}
426426

0 commit comments

Comments
 (0)