Skip to content

Commit e96fee9

Browse files
committed
Refactor test utility script
1 parent a2cff9a commit e96fee9

16 files changed

+156
-115
lines changed

test/dataTypeXML.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
const oracledb = require('oracledb');
3131
const should = require('should');
3232
const dbconfig = require('./dbconfig.js');
33-
const sodaUtil = require('./sodaUtil.js');
33+
const testsUtil = require('./testsUtil.js');
3434

3535
describe('181. dataTypeXML.js', () => {
3636

@@ -179,7 +179,7 @@ describe('181. dataTypeXML.js', () => {
179179

180180
let sql = "insert into " + tableName + " ( num, content ) values ( :id, XMLType(:bv) )";
181181
let bindValues = { id: ID, bv: XML };
182-
await sodaUtil.assertThrowsAsync(
182+
await testsUtil.assertThrowsAsync(
183183
async () => await conn.execute(sql, bindValues),
184184
/ORA-01400:/
185185
);

test/deferLibInit3.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
const oracledb = require('oracledb');
22
const should = require('should');
3-
const sodaUtil = require('./sodaUtil.js');
3+
const testsUtil = require('./testsUtil.js');
44
const dbconfig = require('./dbconfig.js');
55

66
describe('deferLibInit3.js', () => {
77

88
it('child process #3 of test/deferLibInit.js', async () => {
99
let conn;
10-
await sodaUtil.assertThrowsAsync(
10+
await testsUtil.assertThrowsAsync(
1111
async () => conn = await oracledb.getConnection(dbconfig),
1212
/DPI-1047:/
1313
);

test/externalProxyAuth.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
const oracledb = require('oracledb');
3636
const should = require('should');
3737
const dbconfig = require('./dbconfig.js');
38-
const sodaUtil = require('./sodaUtil.js')
38+
const testsUtil = require('./testsUtil.js')
3939

4040
async function ShowUserInfo(conn) {
4141
let result = await conn.execute(`
@@ -49,10 +49,10 @@ async function ShowUserInfo(conn) {
4949

5050
describe('180. externalProxyAuth.js', function () {
5151

52-
before('Check version greater than 1803000000', async function () {
53-
let preReqSucc = await sodaUtil.checkPrerequisites();
52+
before('Check version greater than 1202000000', async function () {
53+
let preReqSucc = await testsUtil.checkPrerequisites(1202000000, 1202000000);
5454
if (!preReqSucc) {
55-
console.log(" Version less than 1803000000, Aborting.");
55+
console.log(" Version less than 1202000000, Aborting.");
5656
this.skip();
5757
}
5858
});
@@ -164,7 +164,7 @@ describe('180. externalProxyAuth.js', function () {
164164
}
165165
let conn;
166166
try {
167-
await sodaUtil.assertThrowsAsync(
167+
await testsUtil.assertThrowsAsync(
168168
async () => {
169169
conn = await oracledb.getConnection({
170170
connectString: dbconfig.connectString,
@@ -327,7 +327,7 @@ describe('180. externalProxyAuth.js', function () {
327327
}
328328
let conn, pool;
329329
try {
330-
await sodaUtil.assertThrowsAsync(
330+
await testsUtil.assertThrowsAsync(
331331
async () => {
332332
pool = await oracledb.createPool({
333333
...dbconfig,
@@ -364,7 +364,7 @@ describe('180. externalProxyAuth.js', function () {
364364
}
365365
let conn, pool;
366366
try {
367-
await sodaUtil.assertThrowsAsync(
367+
await testsUtil.assertThrowsAsync(
368368
async () => {
369369
pool = await oracledb.createPool({
370370
connectString: dbconfig.connectString,
@@ -402,7 +402,7 @@ describe('180. externalProxyAuth.js', function () {
402402
}
403403
let conn, pool;
404404
try {
405-
await sodaUtil.assertThrowsAsync(
405+
await testsUtil.assertThrowsAsync(
406406
async () => {
407407
pool = await oracledb.createPool({
408408
connectString: dbconfig.connectString,
@@ -474,7 +474,7 @@ describe('180. externalProxyAuth.js', function () {
474474
}
475475
let conn, pool;
476476
try {
477-
await sodaUtil.assertThrowsAsync(
477+
await testsUtil.assertThrowsAsync(
478478
async () => {
479479
pool = await oracledb.createPool({
480480
connectString: dbconfig.connectString,

test/sessionTag.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
const oracledb = require('oracledb');
3131
const should = require('should');
3232
const dbconfig = require('./dbconfig.js');
33-
const sodaUtil = require('./sodaUtil.js')
33+
const testsUtil = require('./testsUtil.js')
3434

3535
const tag1 = "LANGUAGE=FRENCH";
3636
const tag2 = "LANGUAGE=GERMAN";
@@ -364,7 +364,7 @@ describe('184. sessionTag.js', function () {
364364
...dbconfig,
365365
sessionCallback: "plsql_fixup_test.set_tag_callback",
366366
});
367-
await sodaUtil.assertThrowsAsync(
367+
await testsUtil.assertThrowsAsync(
368368
async () => {
369369
conn = await pool.getConnection({tag: tagBad});
370370
},
@@ -866,7 +866,7 @@ describe('184. sessionTag.js', function () {
866866
...dbconfig,
867867
sessionCallback: asyncTagFixup,
868868
});
869-
await sodaUtil.assertThrowsAsync(
869+
await testsUtil.assertThrowsAsync(
870870
async () => {
871871
conn = await pool.getConnection({tag: tagBad});
872872
},
@@ -903,7 +903,7 @@ describe('184. sessionTag.js', function () {
903903
...dbconfig,
904904
sessionCallback: tagFixup,
905905
});
906-
await sodaUtil.assertThrowsAsync(
906+
await testsUtil.assertThrowsAsync(
907907
async () => {
908908
conn = await pool.getConnection({tag: tagBad});
909909
},
@@ -1177,7 +1177,7 @@ describe('184. sessionTag.js', function () {
11771177
sessionCallback: tagFixup,
11781178
});
11791179
conn = await pool.getConnection({tag: tag1});
1180-
await sodaUtil.assertThrowsAsync(() => {
1180+
await testsUtil.assertThrowsAsync(() => {
11811181
conn.tag = undefined;
11821182
},
11831183
/NJS-004/ //NJS-004: invalid value for property
@@ -1210,7 +1210,7 @@ describe('184. sessionTag.js', function () {
12101210
sessionCallback: tagFixup,
12111211
});
12121212
conn = await pool.getConnection({tag: tag1});
1213-
await sodaUtil.assertThrowsAsync(() => {
1213+
await testsUtil.assertThrowsAsync(() => {
12141214
conn.tag = {data: ["doesn't matter"], status: "SUCC"};
12151215
},
12161216
/NJS-004/ //NJS-004: invalid value for property
@@ -1244,7 +1244,7 @@ describe('184. sessionTag.js', function () {
12441244
});
12451245
conn = await pool.getConnection({tag: tag1});
12461246
conn.tag = "it doesn't matter";
1247-
await sodaUtil.assertThrowsAsync(async () => {
1247+
await testsUtil.assertThrowsAsync(async () => {
12481248
await conn.close();
12491249
},
12501250
/ORA-24488/ //ORA-24488: Invalid properties or values provided for OCISessionRelease
@@ -1576,7 +1576,7 @@ describe('184. sessionTag.js', function () {
15761576
} finally {
15771577
if (conn) {
15781578
try {
1579-
await sodaUtil.assertThrowsAsync(
1579+
await testsUtil.assertThrowsAsync(
15801580
async () => {
15811581
await conn.close({drop: {data: ["doesn't matter"], status: "SUCC"}});
15821582
},
@@ -1612,7 +1612,7 @@ describe('184. sessionTag.js', function () {
16121612
} finally {
16131613
if (conn) {
16141614
try {
1615-
await sodaUtil.assertThrowsAsync(
1615+
await testsUtil.assertThrowsAsync(
16161616
async () => {
16171617
await conn.close({drop: 0});
16181618
},
@@ -1648,7 +1648,7 @@ describe('184. sessionTag.js', function () {
16481648
} finally {
16491649
if (conn) {
16501650
try {
1651-
await sodaUtil.assertThrowsAsync(
1651+
await testsUtil.assertThrowsAsync(
16521652
async () => {
16531653
await conn.close({drop: {}});
16541654
},
@@ -1683,7 +1683,7 @@ describe('184. sessionTag.js', function () {
16831683
} finally {
16841684
if (conn) {
16851685
try {
1686-
await sodaUtil.assertThrowsAsync(
1686+
await testsUtil.assertThrowsAsync(
16871687
async () => {
16881688
await conn.close({drop: "it doesn't matter"});
16891689
},

test/soda1.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@
2727
*****************************************************************************/
2828
'use strict';
2929

30-
const oracledb = require('oracledb');
31-
const should = require('should');
32-
const dbconfig = require('./dbconfig.js');
33-
const sodaUtil = require('./sodaUtil.js');
30+
const oracledb = require('oracledb');
31+
const should = require('should');
32+
const dbconfig = require('./dbconfig.js');
33+
const sodaUtil = require('./sodaUtil.js');
34+
const testsUtil = require('./testsUtil.js');
3435

3536
describe('164. soda1.js', () => {
3637

3738
before(async function() {
38-
const runnable = await sodaUtil.checkPrerequisites();
39+
const runnable = await testsUtil.checkPrerequisites();
3940
if (!runnable) {
4041
this.skip();
4142
return;
@@ -431,7 +432,7 @@ describe('164. soda1.js', () => {
431432
let t_collname = "soda_test_164_11";
432433
let options = { metaData: "metaData" };
433434

434-
await sodaUtil.assertThrowsAsync(
435+
await testsUtil.assertThrowsAsync(
435436
async () => await sd.createCollection(t_collname, options),
436437
/NJS-006:/
437438
);

test/soda11.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,16 @@
2929
*****************************************************************************/
3030
'use strict';
3131

32-
const oracledb = require('oracledb');
33-
const should = require('should');
34-
const dbconfig = require('./dbconfig.js');
35-
const sodaUtil = require('./sodaUtil.js');
32+
const oracledb = require('oracledb');
33+
const should = require('should');
34+
const dbconfig = require('./dbconfig.js');
35+
const sodaUtil = require('./sodaUtil.js');
36+
const testsUtil = require('./testsUtil.js');
3637

3738
describe('179. soda11.js', () => {
3839

3940
before(async function() {
40-
const runnable = await sodaUtil.checkPrerequisites();
41+
const runnable = await testsUtil.checkPrerequisites();
4142
if (!runnable) {
4243
this.skip();
4344
return;
@@ -162,7 +163,7 @@ describe('179. soda11.js', () => {
162163

163164
let t_collname = "soda_test_179_2";
164165
let options = { metaData: t_metadata };
165-
await sodaUtil.assertThrowsAsync(
166+
await testsUtil.assertThrowsAsync(
166167
async () => await sd.createCollection(t_collname, options),
167168
/ORA-01918:/
168169
);
@@ -272,7 +273,7 @@ describe('179. soda11.js', () => {
272273

273274
let options2 = { metaData: t_metadata2 };
274275

275-
await sodaUtil.assertThrowsAsync(
276+
await testsUtil.assertThrowsAsync(
276277
async () => await sd.createCollection(t_collname, options2),
277278
/ORA-40669:/
278279
);
@@ -431,7 +432,7 @@ describe('179. soda11.js', () => {
431432
/* The key must always be a string and is always returned a string as
432433
well -- even if the "type" in the database is numeric. */
433434
let testKey = 86755;
434-
await sodaUtil.assertThrowsAsync(
435+
await testsUtil.assertThrowsAsync(
435436
async () => await sd.createDocument(testContent, { key: testKey } ),
436437
/NJS-008: invalid type for "key" in parameter 2/
437438
);
@@ -600,7 +601,7 @@ describe('179. soda11.js', () => {
600601
/* Negative value */
601602
let testMediaType = 65432;
602603
let testKey = '86755';
603-
await sodaUtil.assertThrowsAsync(
604+
await testsUtil.assertThrowsAsync(
604605
async () => await sd.createDocument(
605606
testContent,
606607
{ mediaType: testMediaType, key: testKey }

test/soda2.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@
2727
*****************************************************************************/
2828
'use strict';
2929

30-
const oracledb = require('oracledb');
31-
const should = require('should');
32-
const dbconfig = require('./dbconfig.js');
33-
const sodaUtil = require('./sodaUtil.js');
30+
const oracledb = require('oracledb');
31+
const should = require('should');
32+
const dbconfig = require('./dbconfig.js');
33+
const sodaUtil = require('./sodaUtil.js');
34+
const testsUtil = require('./testsUtil.js');
3435

3536
describe('165. soda2.js', () => {
3637

3738
before(async function() {
38-
const runnable = await sodaUtil.checkPrerequisites();
39+
const runnable = await testsUtil.checkPrerequisites();
3940
if (!runnable) {
4041
this.skip();
4142
return;
@@ -140,7 +141,7 @@ describe('165. soda2.js', () => {
140141
let sd = conn.getSodaDatabase();
141142

142143
let collName = "";
143-
await sodaUtil.assertThrowsAsync(
144+
await testsUtil.assertThrowsAsync(
144145
async () => await sd.createCollection(collName),
145146
/ORA-40658:/
146147
);

test/soda3.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@
2727
*****************************************************************************/
2828
'use strict';
2929

30-
const oracledb = require('oracledb');
31-
const should = require('should');
32-
const dbconfig = require('./dbconfig.js');
33-
const sodaUtil = require('./sodaUtil.js');
30+
const oracledb = require('oracledb');
31+
const should = require('should');
32+
const dbconfig = require('./dbconfig.js');
33+
const sodaUtil = require('./sodaUtil.js');
34+
const testsUtil = require('./testsUtil.js');
3435

3536
describe('167. soda3.js', () => {
3637

@@ -43,7 +44,7 @@ describe('167. soda3.js', () => {
4344
];
4445

4546
before('create collections', async function() {
46-
isRunnable = await sodaUtil.checkPrerequisites();
47+
isRunnable = await testsUtil.checkPrerequisites();
4748
if (!isRunnable) {
4849
this.skip();
4950
return;
@@ -128,7 +129,7 @@ describe('167. soda3.js', () => {
128129
it('167.5 getCollectionNames() - limit is null', async () => {
129130
try {
130131
let options = { limit: null };
131-
await sodaUtil.assertThrowsAsync(
132+
await testsUtil.assertThrowsAsync(
132133
async () => await sd.getCollectionNames(options),
133134
/NJS-007: invalid value for "limit" in parameter 2/
134135
);
@@ -140,7 +141,7 @@ describe('167. soda3.js', () => {
140141
it('167.6 getCollectionNames() - limit is an empty string', async () => {
141142
try {
142143
let options = { limit: '' };
143-
await sodaUtil.assertThrowsAsync(
144+
await testsUtil.assertThrowsAsync(
144145
async () => await sd.getCollectionNames(options),
145146
/NJS-008: invalid type for "limit" in parameter 2/
146147
);
@@ -195,7 +196,7 @@ describe('167. soda3.js', () => {
195196
it('167.11 startsWith is null', async () => {
196197
try {
197198
let options = { startsWith: null };
198-
await sodaUtil.assertThrowsAsync(
199+
await testsUtil.assertThrowsAsync(
199200
async () => await sd.getCollectionNames(options),
200201
/NJS-007: invalid value for "startsWith" in parameter 2/
201202
);
@@ -207,7 +208,7 @@ describe('167. soda3.js', () => {
207208
it('167.12 Negative - startsWith has invalid type, a Number', async () => {
208209
try {
209210
let options = { startsWith: 7 };
210-
await sodaUtil.assertThrowsAsync(
211+
await testsUtil.assertThrowsAsync(
211212
async () => await sd.getCollectionNames(options),
212213
/NJS-008: invalid type for "startsWith" in parameter 2/
213214
);

test/soda4.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ const oracledb = require('oracledb');
3131
const should = require('should');
3232
const dbconfig = require('./dbconfig.js');
3333
const sodaUtil = require('./sodaUtil.js');
34+
const testsUtil = require('./testsUtil.js');
3435

3536
describe('168. soda4.js', () => {
3637

3738
before(async function() {
38-
const runnable = await sodaUtil.checkPrerequisites();
39+
const runnable = await testsUtil.checkPrerequisites();
3940
if (!runnable) {
4041
this.skip();
4142
return;

0 commit comments

Comments
 (0)