Skip to content

Commit f04a8c8

Browse files
committed
Fix version portability of SODA hint tests
1 parent 5313d15 commit f04a8c8

File tree

3 files changed

+73
-29
lines changed

3 files changed

+73
-29
lines changed

test/soda10.js

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const dbconfig = require('./dbconfig.js');
3333
const sodaUtil = require('./sodaUtil.js');
3434
const testsUtil = require('./testsUtil.js');
3535

36-
describe('178. soda10.js', () => {
36+
describe('178. soda10.js', function() {
3737

3838
let runnable;
3939
let conn, soda;
@@ -72,7 +72,7 @@ describe('178. soda10.js', () => {
7272
{ id: 4, name: "Changjie", office: "Shenzhen" }
7373
];
7474

75-
it('178.1 insertMany() with newSodaDocumentArray', async () => {
75+
it('178.1 insertMany() with newSodaDocumentArray', async function() {
7676
try {
7777
const COLL = "soda_test_178_1";
7878
const collection = await soda.createCollection(COLL);
@@ -102,7 +102,7 @@ describe('178. soda10.js', () => {
102102
}
103103
}); // 178.1
104104

105-
it('178.2 insertMany() with newSodaDocumentContentArray', async () => {
105+
it('178.2 insertMany() with newSodaDocumentContentArray', async function() {
106106
try {
107107
const COLL = "soda_test_178_2";
108108
const collection = await soda.createCollection(COLL);
@@ -127,7 +127,7 @@ describe('178. soda10.js', () => {
127127
}
128128
}); // 178.2
129129

130-
it('178.3 insertManyAndGet() with newDocumentArray', async () => {
130+
it('178.3 insertManyAndGet() with newDocumentArray', async function() {
131131
try {
132132
const COLL = "soda_test_178_3";
133133
const collection = await soda.createCollection(COLL);
@@ -163,7 +163,7 @@ describe('178. soda10.js', () => {
163163
}
164164
}); // 178.3
165165

166-
it('178.4 insertManyAndGet() with newDocumentContentArray', async () => {
166+
it('178.4 insertManyAndGet() with newDocumentContentArray', async function() {
167167
try {
168168
const COLL = "soda_test_178_4";
169169
const collection = await soda.createCollection(COLL);
@@ -194,13 +194,13 @@ describe('178. soda10.js', () => {
194194
}
195195
}); // 178.4
196196

197-
it('178.5 Negative - insertMany() with an empty array', async () => {
197+
it('178.5 Negative - insertMany() with an empty array', async function() {
198198
try {
199199
const COLL = "soda_test_178_5";
200200
const collection = await soda.createCollection(COLL);
201201

202202
await testsUtil.assertThrowsAsync(
203-
async () => {
203+
async function() {
204204
await collection.insertMany([]);
205205
},
206206
/NJS-005/
@@ -215,13 +215,13 @@ describe('178. soda10.js', () => {
215215
}
216216
}); // 178.5
217217

218-
it('178.6 Negative - insertManyAndGet() with an empty array', async () => {
218+
it('178.6 Negative - insertManyAndGet() with an empty array', async function() {
219219
try {
220220
const COLL = "soda_test_178_6";
221221
const collection = await soda.createCollection(COLL);
222222

223223
await testsUtil.assertThrowsAsync(
224-
async () => {
224+
async function() {
225225
await collection.insertManyAndGet([]);
226226
},
227227
/NJS-005/
@@ -236,7 +236,16 @@ describe('178. soda10.js', () => {
236236
}
237237
}); // 178.6
238238

239-
it('178.7 insertManyAndGet() with hint option', async () => {
239+
it('178.7 insertManyAndGet() with hint option', async function() {
240+
// The SODA hint is available with Oracle Client 21.3 and
241+
// in 19 from 19.11
242+
if (oracledb.oracleClientVersion < 2103000000) {
243+
if (oracledb.oracleClientVersion < 1911000000 ||
244+
oracledb.oracleClientVersion >= 2000000000) {
245+
this.skip();
246+
return;
247+
}
248+
}
240249
const COLL = "soda_test_178_7";
241250
const collection = await soda.createCollection(COLL);
242251

@@ -269,7 +278,7 @@ describe('178. soda10.js', () => {
269278
should.strictEqual(res.dropped, true);
270279
}); // 178.7
271280

272-
it('178.8 Negative - insertManyAndGet() with invalid options parameter', async () => {
281+
it('178.8 Negative - insertManyAndGet() with invalid options parameter', async function() {
273282
const COLL = "soda_test_178_8";
274283
const collection = await soda.createCollection(COLL);
275284

@@ -280,7 +289,7 @@ describe('178. soda10.js', () => {
280289

281290
let options = 3;
282291
await testsUtil.assertThrowsAsync(
283-
async () => {
292+
async function() {
284293
await collection.insertManyAndGet(inDocuments, options);
285294
},
286295
/NJS-005/

test/soda6.js

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const testsUtil = require('./testsUtil.js');
3535

3636
const t_contents = sodaUtil.t_contents;
3737

38-
describe('174. soda6.js', () => {
38+
describe('174. soda6.js', function() {
3939

4040
before(async function() {
4141
const runnable = await testsUtil.isSodaRunnable();
@@ -47,7 +47,7 @@ describe('174. soda6.js', () => {
4747
await sodaUtil.cleanup();
4848
});
4949

50-
it('174.1 filter() basic case', async () => {
50+
it('174.1 filter() basic case', async function() {
5151
let conn, collection;
5252

5353
try {
@@ -86,7 +86,7 @@ describe('174. soda6.js', () => {
8686
}
8787
}); // 174.1
8888

89-
it('174.2 Negative - fiter(filterSpec) when filterSpec is null', async () => {
89+
it('174.2 Negative - fiter(filterSpec) when filterSpec is null', async function() {
9090
let conn, collection;
9191

9292
try {
@@ -124,7 +124,7 @@ describe('174. soda6.js', () => {
124124
}
125125
}); // 174.2
126126

127-
it('174.3 filterSpec is OK to be an empty object', async () => {
127+
it('174.3 filterSpec is OK to be an empty object', async function() {
128128
let conn, collection;
129129

130130
try {
@@ -162,7 +162,7 @@ describe('174. soda6.js', () => {
162162
}
163163
}); // 174.3
164164

165-
it('174.4 Key(), basic case', async () => {
165+
it('174.4 Key(), basic case', async function() {
166166
let conn, collection;
167167

168168
try {
@@ -212,7 +212,7 @@ describe('174. soda6.js', () => {
212212
}
213213
}); // 174.4
214214

215-
it('174.5 Key(), no matched key', async () => {
215+
it('174.5 Key(), no matched key', async function() {
216216
let conn, collection;
217217

218218
try {
@@ -250,7 +250,7 @@ describe('174. soda6.js', () => {
250250
}
251251
}); // 174.5
252252

253-
it('174.6 Negative - Key(null)', async () => {
253+
it('174.6 Negative - Key(null)', async function() {
254254
let conn, collection;
255255

256256
try {
@@ -287,7 +287,7 @@ describe('174. soda6.js', () => {
287287
}
288288
}); // 174.6
289289

290-
it('174.7 Key(), invalid type', async () => {
290+
it('174.7 Key(), invalid type', async function() {
291291
let conn, collection;
292292

293293
try {
@@ -326,7 +326,7 @@ describe('174. soda6.js', () => {
326326
}
327327
}); // 174.7
328328

329-
it('174.8 Keys(), basic case', async () => {
329+
it('174.8 Keys(), basic case', async function() {
330330
let conn, collection;
331331

332332
try {
@@ -370,7 +370,7 @@ describe('174. soda6.js', () => {
370370
}
371371
}); // 174.8
372372

373-
it('174.9 Keys([]) empty array, it selects all documents', async () => {
373+
it('174.9 Keys([]) empty array, it selects all documents', async function() {
374374
let conn, collection;
375375

376376
try {
@@ -414,7 +414,7 @@ describe('174. soda6.js', () => {
414414
}
415415
}); // 174.9
416416

417-
it('174.10 Negative - keys() no parameter', async () => {
417+
it('174.10 Negative - keys() no parameter', async function() {
418418
let conn, collection;
419419

420420
try {
@@ -452,7 +452,7 @@ describe('174. soda6.js', () => {
452452
}
453453
}); // 174.10
454454

455-
it('174.11 Negative - keys(null)', async () => {
455+
it('174.11 Negative - keys(null)', async function() {
456456
let conn, collection;
457457

458458
try {
@@ -491,7 +491,7 @@ describe('174. soda6.js', () => {
491491
}
492492
}); // 174.11
493493

494-
it('174.12 try to query documents with nonexistent keys', async () => {
494+
it('174.12 try to query documents with nonexistent keys', async function() {
495495
let conn, collection;
496496

497497
try {
@@ -534,7 +534,16 @@ describe('174. soda6.js', () => {
534534
}
535535
}); // 174.12
536536

537-
it("174.13 hint(), basic case", async () => {
537+
it("174.13 hint(), basic case", async function() {
538+
// The SODA hint is available with Oracle Client 21.3 and
539+
// in 19 from 19.11
540+
if (oracledb.oracleClientVersion < 2103000000) {
541+
if (oracledb.oracleClientVersion < 1911000000 ||
542+
oracledb.oracleClientVersion >= 2000000000) {
543+
this.skip();
544+
return;
545+
}
546+
}
538547
let conn, collection;
539548

540549
try {
@@ -572,7 +581,16 @@ describe('174. soda6.js', () => {
572581
}
573582
}); //174.13
574583

575-
it("174.14 Negative - hint() no parameter", async () => {
584+
it("174.14 Negative - hint() no parameter", async function() {
585+
// The SODA hint is available with Oracle Client 21.3 and
586+
// in 19 from 19.11
587+
if (oracledb.oracleClientVersion < 2103000000) {
588+
if (oracledb.oracleClientVersion < 1911000000 ||
589+
oracledb.oracleClientVersion >= 2000000000) {
590+
this.skip();
591+
return;
592+
}
593+
}
576594
let conn, collection;
577595

578596
try {
@@ -610,7 +628,16 @@ describe('174. soda6.js', () => {
610628
}
611629
}); //174.14
612630

613-
it("174.15 Negative - hint() invalid parameter type", async () => {
631+
it("174.15 Negative - hint() invalid parameter type", async function() {
632+
// The SODA hint is available with Oracle Client 21.3 and
633+
// in 19 from 19.11
634+
if (oracledb.oracleClientVersion < 2103000000) {
635+
if (oracledb.oracleClientVersion < 1911000000 ||
636+
oracledb.oracleClientVersion >= 2000000000) {
637+
this.skip();
638+
return;
639+
}
640+
}
614641
let conn, collection;
615642

616643
try {

test/sodahint.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,16 @@ describe('257. sodahint.js', () => {
4040

4141
before(async function() {
4242

43+
// The SODA hint is available with Oracle Client 21.3 and
44+
// in 19 from 19.11
45+
if (oracledb.oracleClientVersion < 2103000000) {
46+
if (oracledb.oracleClientVersion < 1911000000 ||
47+
oracledb.oracleClientVersion >= 2000000000) {
48+
this.skip();
49+
return;
50+
}
51+
}
4352
const runnable = await testsUtil.isSodaRunnable();
44-
4553
if (!runnable) {
4654
this.skip();
4755
return;

0 commit comments

Comments
 (0)