Skip to content

Commit 12f9625

Browse files
committed
Test case updates
1 parent 73fd2f8 commit 12f9625

10 files changed

+52
-54
lines changed

test/dbObject18.js

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ describe('242. dbObject18.js', () => {
133133
assert.strictEqual(oracledb.dbObjectAsPojo, false);
134134
}); // 242.1.12
135135

136-
it('242.1.3 negative: set oracledb.dbObjectAsPojo to invalid value: string true', async () => {
136+
it('242.1.13 negative: set oracledb.dbObjectAsPojo to invalid value: string true', async () => {
137137
await assert.rejects(
138138
async () => { //eslint-disable-line
139139
oracledb.dbObjectAsPojo = 'true';
@@ -267,12 +267,8 @@ describe('242. dbObject18.js', () => {
267267
after(async () => {
268268

269269
await testsUtil.dropTable(conn, TABLE);
270-
271-
let sql = testsUtil.sqlDropType(TEAM_T);
272-
await conn.execute(sql);
273-
274-
sql = testsUtil.sqlDropType(PLAYER_T);
275-
await conn.execute(sql);
270+
await testsUtil.dropType(conn, TEAM_T);
271+
await testsUtil.dropType(conn, PLAYER_T);
276272

277273
await conn.close();
278274

@@ -343,15 +339,14 @@ describe('242. dbObject18.js', () => {
343339
sql = `
344340
CREATE TABLE ${TABLE} (sportname VARCHAR2(20), team ${TEAM_T})
345341
`;
346-
sql = testsUtil.sqlCreateTable(TABLE, sql);
347-
await conn.execute(sql);
342+
await testsUtil.createTable(conn, TABLE, sql);
348343

349344
}); // before()
350345

351346
after(async () => {
352-
await conn.execute(testsUtil.sqlDropType(TEAM_T));
353-
await conn.execute(testsUtil.sqlDropType(PLAYER_T));
354-
await conn.execute(testsUtil.sqlDropTable(TABLE));
347+
await testsUtil.dropTable(conn, TABLE);
348+
await testsUtil.dropType(conn, TEAM_T);
349+
await testsUtil.dropType(conn, PLAYER_T);
355350
await conn.close();
356351
oracledb.dbObjectAsPojo = false;
357352
}); // after()
@@ -463,21 +458,15 @@ describe('242. dbObject18.js', () => {
463458
sql = `
464459
CREATE TABLE ${TABLE} (sportname VARCHAR2(20), team ${TEAM_T})
465460
`;
466-
sql = testsUtil.sqlCreateTable(TABLE, sql);
467-
await conn.execute(sql);
461+
await testsUtil.createTable(conn, TABLE, sql);
468462

469463
}); // before()
470464

471465
after(async () => {
472466

473-
let sql = testsUtil.sqlDropTable(TABLE);
474-
await conn.execute(sql);
475-
476-
sql = testsUtil.sqlDropType(TEAM_T);
477-
await conn.execute(sql);
478-
479-
sql = testsUtil.sqlDropType(PLAYER_T);
480-
await conn.execute(sql);
467+
await testsUtil.dropTable(conn, TABLE);
468+
await testsUtil.dropType(conn, TEAM_T);
469+
await testsUtil.dropType(conn, PLAYER_T);
481470

482471
await conn.close();
483472

test/examineOwnedProperties.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2019, 2023, Oracle and/or its affiliates. */
1+
/* Copyright (c) 2019, 2024, Oracle and/or its affiliates. */
22

33
/******************************************************************************
44
*
@@ -52,13 +52,17 @@ describe('220. examineOwnedProperties.js', () => {
5252
"RATING" VARCHAR2(4000)
5353
)
5454
`;
55-
const plsql = testsUtil.sqlCreateTable(TABLE, sql);
56-
await conn.execute(plsql);
55+
await testsUtil.createTable(conn, TABLE, sql);
5756
}); // before()
5857

5958
after(async () => {
6059
const sql = `DROP TABLE ${TABLE} PURGE`;
6160
await conn.execute(sql);
61+
if (Object.prototype.noop) {
62+
// For 220.1, if test fails, ensure the noop function
63+
// object gets destroyed, if created
64+
delete Object.prototype.noop;
65+
}
6266
await conn.close();
6367
}); // after()
6468

test/fetchArraySize3.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ describe("150. fetchArraySize3.js", function() {
8181

8282
after(async function() {
8383
await connection.close();
84+
assert.strictEqual(oracledb.fetchArraySize, default_fetcArraySize);
8485
});
8586

8687
describe("150.1 DML binding", function() {

test/jsonDualityViews1.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2023, Oracle and/or its affiliates. */
1+
/* Copyright (c) 2023, 2024, Oracle and/or its affiliates. */
22

33
/******************************************************************************
44
*
@@ -128,10 +128,10 @@ describe('272. jsonDualityView1.js', function() {
128128
});
129129

130130
after(async function() {
131-
await connection.execute(testsUtil.sqlDropTable(`employees`));
132-
await connection.execute(testsUtil.sqlDropTable(`departments`));
133-
await connection.execute(`drop view emp_ov`);
134-
await connection.execute(`drop view dept_ov`);
131+
await testsUtil.dropTable(connection, 'employees');
132+
await testsUtil.dropTable(connection, 'departments');
133+
await connection.execute(`drop view if exists emp_ov`);
134+
await connection.execute(`drop view if exists dept_ov`);
135135
await connection.close();
136136
});
137137

@@ -291,10 +291,10 @@ describe('272. jsonDualityView1.js', function() {
291291
});
292292

293293
after(async function() {
294-
await connection.execute(testsUtil.sqlDropTable(`employees`));
295-
await connection.execute(testsUtil.sqlDropTable(`departments`));
296-
await connection.execute(`drop view emp_ov`);
297-
await connection.execute(`drop view dept_ov`);
294+
await testsUtil.dropTable(connection, 'employees');
295+
await testsUtil.dropTable(connection, 'departments');
296+
await connection.execute(`drop view if exists emp_ov`);
297+
await connection.execute(`drop view if exists dept_ov`);
298298
await connection.close();
299299
});
300300

@@ -326,7 +326,7 @@ describe('272. jsonDualityView1.js', function() {
326326
await connection.execute(`INSERT INTO employees VALUES
327327
( 101
328328
, 'New'
329-
, 'Name'
329+
, 'Name'
330330
, 10
331331
)`);
332332
query = `select * from emp_ov order by 1`;
@@ -454,9 +454,9 @@ describe('272. jsonDualityView1.js', function() {
454454
});
455455

456456
after(async function() {
457-
await connection.execute(testsUtil.sqlDropTable(`student_class`));
458-
await connection.execute(testsUtil.sqlDropTable(`class`));
459-
await connection.execute(testsUtil.sqlDropTable(`student`));
457+
await testsUtil.dropTable(connection, 'student_class');
458+
await testsUtil.dropTable(connection, 'class');
459+
await testsUtil.dropTable(connection, 'student');
460460
await connection.close();
461461
});
462462

@@ -755,7 +755,7 @@ describe('272. jsonDualityView1.js', function() {
755755
)`;
756756

757757
before(async function() {
758-
if (dbConfig.test.drcp || dbConfig.test.isCmanTdm) {
758+
if (dbConfig.test.drcp || dbConfig.test.isCmanTdm || !dbConfig.test.DBA_PRIVILEGE) {
759759
this.skip();
760760
}
761761
const credential = {
@@ -773,7 +773,7 @@ describe('272. jsonDualityView1.js', function() {
773773
});
774774

775775
after(async function() {
776-
if (dbConfig.test.drcp || dbConfig.test.isCmanTdm) {
776+
if (dbConfig.test.drcp || dbConfig.test.isCmanTdm || !dbConfig.test.DBA_PRIVILEGE) {
777777
return;
778778
}
779779
await connection.execute(`drop user ${user1} cascade`);

test/jsonDualityViews2.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2023, Oracle and/or its affiliates. */
1+
/* Copyright (c) 2023, 2024, Oracle and/or its affiliates. */
22

33
/******************************************************************************
44
*
@@ -46,6 +46,7 @@ describe('273. jsonDualityView2.js', function() {
4646
isRunnable = (!dbConfig.test.drcp);
4747
if (isRunnable) {
4848
isRunnable = await testsUtil.checkPrerequisites(2100000000, 2300000000);
49+
isRunnable = isRunnable && dbConfig.test.DBA_PRIVILEGE;
4950
}
5051
if (!isRunnable || dbConfig.test.isCmanTdm) {
5152
this.skip();

test/jsonDualityViews3.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2023, Oracle and/or its affiliates. */
1+
/* Copyright (c) 2023, 2024, Oracle and/or its affiliates. */
22

33
/******************************************************************************
44
*
@@ -46,6 +46,7 @@ describe('274 jsonDualityView3.js', function() {
4646
isRunnable = (!dbConfig.test.drcp);
4747
if (isRunnable) {
4848
isRunnable = await testsUtil.checkPrerequisites(2100000000, 2300000000);
49+
isRunnable = isRunnable && dbConfig.test.DBA_PRIVILEGE;
4950
}
5051
if (!isRunnable || dbConfig.test.isCmanTdm) {
5152
this.skip();

test/jsonDualityViews4.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2023, Oracle and/or its affiliates. */
1+
/* Copyright (c) 2023, 2024, Oracle and/or its affiliates. */
22

33
/******************************************************************************
44
*
@@ -46,6 +46,7 @@ describe('275. jsonDualityView4.js', function() {
4646
isRunnable = (!dbConfig.test.drcp);
4747
if (isRunnable) {
4848
isRunnable = await testsUtil.checkPrerequisites(2300000000, 2300000000);
49+
isRunnable = isRunnable && dbConfig.test.DBA_PRIVILEGE;
4950
}
5051
if (!isRunnable || dbConfig.test.isCmanTdm) {
5152
this.skip();

test/jsonDualityViews5.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2023, Oracle and/or its affiliates. */
1+
/* Copyright (c) 2023, 2024, Oracle and/or its affiliates. */
22

33
/******************************************************************************
44
*
@@ -46,6 +46,7 @@ describe('276. jsonDualityView5.js', function() {
4646
isRunnable = (!dbConfig.test.drcp);
4747
if (isRunnable) {
4848
isRunnable = await testsUtil.checkPrerequisites(2100000000, 2300000000);
49+
isRunnable = isRunnable && dbConfig.test.DBA_PRIVILEGE;
4950
}
5051
if (!isRunnable || dbConfig.test.isCmanTdm) {
5152
this.skip();
@@ -100,9 +101,9 @@ describe('276. jsonDualityView5.js', function() {
100101
after(async function() {
101102
if (!isRunnable || dbConfig.test.isCmanTdm) return;
102103

103-
await connection.execute(testsUtil.sqlDropTable('student_class'));
104-
await connection.execute(testsUtil.sqlDropTable('class'));
105-
await connection.execute(testsUtil.sqlDropTable('student'));
104+
await testsUtil.dropTable(connection, 'student_class');
105+
await testsUtil.dropTable(connection, 'class');
106+
await testsUtil.dropTable(connection, 'student');
106107
await connection.close();
107108

108109
await dbaConn.execute(`drop user njs_jsonDv5 cascade`);

test/list.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4853,7 +4853,7 @@ oracledb.OUT_FORMAT_OBJECT and resultSet = true
48534853
242.1.10 negative: set oracledb.dbObjectAsPojo to invalid value: null
48544854
242.1.11 negative: set oracledb.dbObjectAsPojo to invalid value: 0
48554855
242.1.12 negative: set oracledb.dbObjectAsPojo to invalid value: number
4856-
242.1.3 negative: set oracledb.dbObjectAsPojo to invalid value: string true
4856+
242.1.13 negative: set oracledb.dbObjectAsPojo to invalid value: string true
48574857
242.1.14 negative: set oracledb.dbObjectAsPojo to invalid value: string false
48584858
242.1.15 negative: set oracledb.dbObjectAsPojo to invalid value: undefined
48594859
242.1.16 negative: set oracledb.dbObjectAsPojo to invalid value: NaN

test/random.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@
3232
*****************************************************************************/
3333
'use strict';
3434

35-
let random = exports;
35+
const random = exports;
3636
module.exports = random;
3737

38-
// generate a random string which length is 'length', with specialStr in it's head and tail
38+
// generate a random string which length is 'length', with specialStr in its head and tail
3939
random.getRandomString = function(length, specialStr) {
4040
let str = '';
41-
let strLength = length - specialStr.length * 2;
41+
const strLength = length - specialStr.length * 2;
4242
for (; str.length < strLength; str += Math.random().toString(36).slice(2));
4343
str = str.slice(0, strLength);
4444
str = specialStr + str + specialStr;
@@ -53,7 +53,7 @@ random.getRandomLengthString = function(length) {
5353
};
5454

5555
random.getRandomNumArray = function(size) {
56-
let numbers = new Array(size);
56+
const numbers = new Array(size);
5757
for (let i = 0; i < numbers.length; i++) {
5858
numbers[i] = this.getRandomInt(1, 9999999);
5959
}
@@ -67,9 +67,9 @@ random.getRandomInt = function(min, max) {
6767
};
6868

6969
random.getIntArray = function(N) {
70-
let arr = Array.apply(null, Array(N));
70+
const arr = Array.apply(null, Array(N));
7171
// The map() method creates a new array with the results of calling a provided function on every element in this array.
72-
// var new_array = arr.map(callback[, thisArg])
72+
// let new_array = arr.map(callback[, thisArg])
7373
// Parameters
7474
// callback
7575
// Function that produces an element of the new Array, taking three arguments:

0 commit comments

Comments
 (0)