Skip to content

Commit 4d5e3d2

Browse files
committed
Modify test cases to ensure they do not run in unsupported DB versions
1 parent 3d5dded commit 4d5e3d2

File tree

6 files changed

+75
-19
lines changed

6 files changed

+75
-19
lines changed

Diff for: test/binding_DMLReturningInto.js

+4
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ describe('98.binding_DMLReturningInto.js', function() {
267267
});
268268

269269
it('98.1.12 oracledb.STRING <--> DB: BLOB', async function() {
270+
if (connection.oracleServerVersion < 1202000000)
271+
this.skip();
270272
index++;
271273
const table_name = tableNamePre + index;
272274
const content = "small string";
@@ -535,6 +537,8 @@ describe('98.binding_DMLReturningInto.js', function() {
535537
});
536538

537539
it('98.2.12 oracledb.STRING <--> DB: BLOB', async function() {
540+
if (connection.oracleServerVersion < 1202000000)
541+
this.skip();
538542
index++;
539543
const table_name = tableNamePre + index;
540544
const content = null;

Diff for: test/booleanBind.js

+14-3
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ describe('224. booleanBind.js', function() {
161161
}); // after()
162162

163163
it('224.1 IN bind boolean value', async function() {
164+
if (conn.oracleServerVersion < 1202000000)
165+
this.skip();
164166

165167
const binds = {
166168
inval: true,
@@ -173,6 +175,9 @@ describe('224. booleanBind.js', function() {
173175
}); // 224.1
174176

175177
it('224.2 IN bind value "false"', async function() {
178+
if (conn.oracleServerVersion < 1202000000)
179+
this.skip();
180+
176181
const binds = {
177182
inval: false,
178183
outval: { dir: oracledb.BIND_OUT, type: oracledb.STRING, maxSize: 10 }
@@ -195,21 +200,24 @@ describe('224. booleanBind.js', function() {
195200
}); // 224.3
196201

197202
it('224.4 Negative - IN bind value type mismatch', async function() {
198-
const binds = {
203+
const binds = {
199204
inval: { type: oracledb.DB_TYPE_BOOLEAN, val: 123 },
200205
outval: { dir: oracledb.BIND_OUT, type: oracledb.STRING, maxSize: 10 }
201206
};
202-
const sql = `begin :outval := ${pkgName}.GetStringRep(:inval); end;`;
207+
const sql = `begin :outval := ${pkgName}.GetStringRep(:inval); end;`;
203208

204209
await assert.rejects(
205210
async function() {
206211
await conn.execute(sql, binds);
207212
},
208213
/NJS-011/
209-
);
214+
); // 224.4
210215
});
211216

212217
it('224.5 OUT bind value "false"', async function() {
218+
if (conn.oracleServerVersion < 1202000000)
219+
this.skip();
220+
213221
const binds = {
214222
inval: 12,
215223
outval: { dir: oracledb.BIND_OUT, type: oracledb.DB_TYPE_BOOLEAN }
@@ -221,6 +229,9 @@ describe('224. booleanBind.js', function() {
221229
}); // 224.5
222230

223231
it('224.6 OUT bind value "true"', async function() {
232+
if (conn.oracleServerVersion < 1202000000)
233+
this.skip();
234+
224235
const binds = {
225236
inval: 9,
226237
outval: { dir: oracledb.BIND_OUT, type: oracledb.DB_TYPE_BOOLEAN }

Diff for: test/dataTypeDate.js

+31-2
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ describe('32. dataTypeDate.js', function() {
147147
describe('32.4 Select invalid dates', function() {
148148

149149
it('32.4.1 Negative - Invalid Year 0', async function() {
150+
if (connection.oracleServerVersion < 1202000000)
151+
this.skip();
152+
150153
const invalidYear = 0;
151154
const sql = `SELECT DATE '${invalidYear}-01-01' FROM DUAL`;
152155

@@ -160,7 +163,33 @@ describe('32. dataTypeDate.js', function() {
160163
);
161164
});
162165

163-
it('32.4.2 Negative - Invalid Year -4713', async function() {
166+
it('32.4.2 No ORA-01841 error in Oracle 12.1 server', async function() {
167+
if (connection.oracleServerVersion >= 1202000000)
168+
this.skip();
169+
const myFetchTypeHandler = function(metadata) {
170+
if (metadata.dbType === oracledb.DB_TYPE_DATE) {
171+
const myConverter = (v) => {
172+
if (v !== null) {
173+
v = v.toLocaleString('fr');
174+
}
175+
return v;
176+
};
177+
return {converter: myConverter};
178+
}
179+
};
180+
const invalidYear = 0;
181+
const sql = `SELECT DATE '${invalidYear}-01-01' FROM DUAL`;
182+
const binds = [];
183+
const options = {fetchTypeHandler: myFetchTypeHandler};
184+
const result = await connection.execute(sql, binds, options);
185+
assert.strictEqual(typeof result.rows[0][0], 'string');
186+
187+
// Add an assert statement to check the result
188+
assert.deepStrictEqual(result.rows,
189+
[['01/01/1900, 00:00:00']]);
190+
});
191+
192+
it('32.4.3 Negative - Invalid Year -4713', async function() {
164193
const invalidYear = -4713;
165194
const sql = `SELECT DATE '${invalidYear}-01-01' FROM DUAL`;
166195

@@ -174,7 +203,7 @@ describe('32. dataTypeDate.js', function() {
174203
);
175204
});
176205

177-
it('32.4.3 Negative - Invalid Year 10000', async function() {
206+
it('32.4.4 Negative - Invalid Year 10000', async function() {
178207
const invalidYear = 10000;
179208
const sql = `SELECT DATE '${invalidYear}-01-01' FROM DUAL`;
180209

Diff for: test/dbObject14.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,24 @@ describe('213. dbObject14.js', () => {
150150

151151
describe('213.2 Object Collection with BLOB fields', () => {
152152
let conn;
153-
const TABLE = 'NODB_TAB_BUF_COLLECTION_14_1';
153+
let TABLE;
154154
const BUF_TYPE = 'NODB_TYP_BUFFER_14_1';
155-
const BUF_TYPE_COLLECTION = 'NODB_TYP_BUFFER_COLLECTION_14_1';
155+
let BUF_TYPE_COLLECTION;
156156
const TEST_PROC = 'NODB_PROC_14_1';
157157

158158
before(async function() {
159159
if (oracledb.thin) {
160160
return this.skip();
161161
}
162162
conn = await oracledb.getConnection(dbConfig);
163+
if (conn.oracleServerVersion < 1202000000) {
164+
//The maximum length for 12.1 db database object names is 30 characters
165+
TABLE = 'NODB_TAB_BUF_COLLECTION_14';
166+
BUF_TYPE_COLLECTION = 'NODB_TYP_BUFFER_COLLECTION_14';
167+
} else {
168+
TABLE = 'NODB_TAB_BUF_COLLECTION_14_1';
169+
BUF_TYPE_COLLECTION = 'NODB_TYP_BUFFER_COLLECTION_14_1';
170+
}
163171

164172
let sql = `
165173
CREATE OR REPLACE TYPE ${BUF_TYPE} AS OBJECT (

Diff for: test/dbObject6.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('205. dbObject6.js', () => {
4444

4545
before(async function() {
4646
conn = await oracledb.getConnection(dbConfig);
47-
if (conn.oracleServerVersion < 1200000000) {
47+
if (conn.oracleServerVersion < 1202000000) {
4848
this.skip();
4949
}
5050

Diff for: test/list.txt

+15-11
Original file line numberDiff line numberDiff line change
@@ -534,15 +534,17 @@ Overview of node-oracledb functional tests
534534
32.1.3 works well with REF Cursor
535535
32.1.4 columns fetched from REF CURSORS can be mapped by fetchInfo settings
536536
32.1.5 columns fetched from REF CURSORS can be mapped by oracledb.fetchAsString
537+
32.1.6 works well with SELECT query after session TimeZone change
537538
32.2 stores null value correctly
538539
32.2.1 testing Null, Empty string and Undefined
539540
32.3 insert SQL Date data
540541
32.3.1 SELECT query - original data
541542
32.3.2 SELECT query - formatted data for comparison
542543
32.4 Select invalid dates
543544
32.4.1 Negative - Invalid Year 0
544-
32.4.2 Negative - Invalid Year -4713
545-
32.4.3 Negative - Invalid Year 10000
545+
32.4.2 No ORA-01841 error in Oracle 12.1 server
546+
32.4.3 Negative - Invalid Year -4713
547+
32.4.4 Negative - Invalid Year 10000
546548

547549
33. dataTypeTimestamp1.js
548550
33.1 Testing JavaScript Date with database TIMESTAMP
@@ -4636,14 +4638,16 @@ oracledb.OUT_FORMAT_OBJECT and resultSet = true
46364638

46374639
224. booleanBind.js
46384640
224.1 IN bind boolean value
4639-
224.2 IN bind value "false"
4640-
224.3 IN bind value "null"
4641-
224.4 Negative - IN bind value type mismatch
4642-
224.5 OUT bind value "false"
4643-
224.6 OUT bind value "true"
4644-
224.7 IN bind array with boolean data
4645-
224.8 OUT bind array with boolean data
4646-
224.9 INOUT bind record with boolean data
4641+
224.2 Negative: IN bind boolean value for 12.1 DB
4642+
224.3 IN bind value "false"
4643+
224.4 IN bind value "null"
4644+
224.5 Negative - IN bind value type mismatch
4645+
224.6 OUT bind value "false"
4646+
224.7 OUT bind value "true"
4647+
224.8 IN bind array with boolean data
4648+
224.9 OUT bind array with boolean data
4649+
224.10 INOUT bind record with boolean data
4650+
224.11 OUT bind value "null"
46474651

46484652
226. dbType01.js
46494653
226.1 DB_TYPE_VARCHAR
@@ -5062,7 +5066,7 @@ oracledb.OUT_FORMAT_OBJECT and resultSet = true
50625066
254.2.5 Using JSON_VALUE to extract a value from a VARCHAR2 column
50635067
254.2.6 Using dot-notation to extract a value from a VARCHAR2 column
50645068
254.3 Map javascript object into CLOB
5065-
254.3.1 Number, String type (41ms)
5069+
254.3.1 Number, String type
50665070
254.3.2 Boolean and null value
50675071
254.3.3 Array type
50685072
254.3.4 Object type

0 commit comments

Comments
 (0)