Test case updates

This commit is contained in:
Sharad Chandran R 2024-05-09 15:15:23 +05:30
parent 73fd2f8514
commit 12f9625d80
10 changed files with 52 additions and 54 deletions

View File

@ -133,7 +133,7 @@ describe('242. dbObject18.js', () => {
assert.strictEqual(oracledb.dbObjectAsPojo, false);
}); // 242.1.12
it('242.1.3 negative: set oracledb.dbObjectAsPojo to invalid value: string true', async () => {
it('242.1.13 negative: set oracledb.dbObjectAsPojo to invalid value: string true', async () => {
await assert.rejects(
async () => { //eslint-disable-line
oracledb.dbObjectAsPojo = 'true';
@ -267,12 +267,8 @@ describe('242. dbObject18.js', () => {
after(async () => {
await testsUtil.dropTable(conn, TABLE);
let sql = testsUtil.sqlDropType(TEAM_T);
await conn.execute(sql);
sql = testsUtil.sqlDropType(PLAYER_T);
await conn.execute(sql);
await testsUtil.dropType(conn, TEAM_T);
await testsUtil.dropType(conn, PLAYER_T);
await conn.close();
@ -343,15 +339,14 @@ describe('242. dbObject18.js', () => {
sql = `
CREATE TABLE ${TABLE} (sportname VARCHAR2(20), team ${TEAM_T})
`;
sql = testsUtil.sqlCreateTable(TABLE, sql);
await conn.execute(sql);
await testsUtil.createTable(conn, TABLE, sql);
}); // before()
after(async () => {
await conn.execute(testsUtil.sqlDropType(TEAM_T));
await conn.execute(testsUtil.sqlDropType(PLAYER_T));
await conn.execute(testsUtil.sqlDropTable(TABLE));
await testsUtil.dropTable(conn, TABLE);
await testsUtil.dropType(conn, TEAM_T);
await testsUtil.dropType(conn, PLAYER_T);
await conn.close();
oracledb.dbObjectAsPojo = false;
}); // after()
@ -463,21 +458,15 @@ describe('242. dbObject18.js', () => {
sql = `
CREATE TABLE ${TABLE} (sportname VARCHAR2(20), team ${TEAM_T})
`;
sql = testsUtil.sqlCreateTable(TABLE, sql);
await conn.execute(sql);
await testsUtil.createTable(conn, TABLE, sql);
}); // before()
after(async () => {
let sql = testsUtil.sqlDropTable(TABLE);
await conn.execute(sql);
sql = testsUtil.sqlDropType(TEAM_T);
await conn.execute(sql);
sql = testsUtil.sqlDropType(PLAYER_T);
await conn.execute(sql);
await testsUtil.dropTable(conn, TABLE);
await testsUtil.dropType(conn, TEAM_T);
await testsUtil.dropType(conn, PLAYER_T);
await conn.close();

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2019, 2023, Oracle and/or its affiliates. */
/* Copyright (c) 2019, 2024, Oracle and/or its affiliates. */
/******************************************************************************
*
@ -52,13 +52,17 @@ describe('220. examineOwnedProperties.js', () => {
"RATING" VARCHAR2(4000)
)
`;
const plsql = testsUtil.sqlCreateTable(TABLE, sql);
await conn.execute(plsql);
await testsUtil.createTable(conn, TABLE, sql);
}); // before()
after(async () => {
const sql = `DROP TABLE ${TABLE} PURGE`;
await conn.execute(sql);
if (Object.prototype.noop) {
// For 220.1, if test fails, ensure the noop function
// object gets destroyed, if created
delete Object.prototype.noop;
}
await conn.close();
}); // after()

View File

@ -81,6 +81,7 @@ describe("150. fetchArraySize3.js", function() {
after(async function() {
await connection.close();
assert.strictEqual(oracledb.fetchArraySize, default_fetcArraySize);
});
describe("150.1 DML binding", function() {

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2023, Oracle and/or its affiliates. */
/* Copyright (c) 2023, 2024, Oracle and/or its affiliates. */
/******************************************************************************
*
@ -128,10 +128,10 @@ describe('272. jsonDualityView1.js', function() {
});
after(async function() {
await connection.execute(testsUtil.sqlDropTable(`employees`));
await connection.execute(testsUtil.sqlDropTable(`departments`));
await connection.execute(`drop view emp_ov`);
await connection.execute(`drop view dept_ov`);
await testsUtil.dropTable(connection, 'employees');
await testsUtil.dropTable(connection, 'departments');
await connection.execute(`drop view if exists emp_ov`);
await connection.execute(`drop view if exists dept_ov`);
await connection.close();
});
@ -291,10 +291,10 @@ describe('272. jsonDualityView1.js', function() {
});
after(async function() {
await connection.execute(testsUtil.sqlDropTable(`employees`));
await connection.execute(testsUtil.sqlDropTable(`departments`));
await connection.execute(`drop view emp_ov`);
await connection.execute(`drop view dept_ov`);
await testsUtil.dropTable(connection, 'employees');
await testsUtil.dropTable(connection, 'departments');
await connection.execute(`drop view if exists emp_ov`);
await connection.execute(`drop view if exists dept_ov`);
await connection.close();
});
@ -326,7 +326,7 @@ describe('272. jsonDualityView1.js', function() {
await connection.execute(`INSERT INTO employees VALUES
( 101
, 'New'
, 'Name'
, 'Name'
, 10
)`);
query = `select * from emp_ov order by 1`;
@ -454,9 +454,9 @@ describe('272. jsonDualityView1.js', function() {
});
after(async function() {
await connection.execute(testsUtil.sqlDropTable(`student_class`));
await connection.execute(testsUtil.sqlDropTable(`class`));
await connection.execute(testsUtil.sqlDropTable(`student`));
await testsUtil.dropTable(connection, 'student_class');
await testsUtil.dropTable(connection, 'class');
await testsUtil.dropTable(connection, 'student');
await connection.close();
});
@ -755,7 +755,7 @@ describe('272. jsonDualityView1.js', function() {
)`;
before(async function() {
if (dbConfig.test.drcp || dbConfig.test.isCmanTdm) {
if (dbConfig.test.drcp || dbConfig.test.isCmanTdm || !dbConfig.test.DBA_PRIVILEGE) {
this.skip();
}
const credential = {
@ -773,7 +773,7 @@ describe('272. jsonDualityView1.js', function() {
});
after(async function() {
if (dbConfig.test.drcp || dbConfig.test.isCmanTdm) {
if (dbConfig.test.drcp || dbConfig.test.isCmanTdm || !dbConfig.test.DBA_PRIVILEGE) {
return;
}
await connection.execute(`drop user ${user1} cascade`);

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2023, Oracle and/or its affiliates. */
/* Copyright (c) 2023, 2024, Oracle and/or its affiliates. */
/******************************************************************************
*
@ -46,6 +46,7 @@ describe('273. jsonDualityView2.js', function() {
isRunnable = (!dbConfig.test.drcp);
if (isRunnable) {
isRunnable = await testsUtil.checkPrerequisites(2100000000, 2300000000);
isRunnable = isRunnable && dbConfig.test.DBA_PRIVILEGE;
}
if (!isRunnable || dbConfig.test.isCmanTdm) {
this.skip();

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2023, Oracle and/or its affiliates. */
/* Copyright (c) 2023, 2024, Oracle and/or its affiliates. */
/******************************************************************************
*
@ -46,6 +46,7 @@ describe('274 jsonDualityView3.js', function() {
isRunnable = (!dbConfig.test.drcp);
if (isRunnable) {
isRunnable = await testsUtil.checkPrerequisites(2100000000, 2300000000);
isRunnable = isRunnable && dbConfig.test.DBA_PRIVILEGE;
}
if (!isRunnable || dbConfig.test.isCmanTdm) {
this.skip();

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2023, Oracle and/or its affiliates. */
/* Copyright (c) 2023, 2024, Oracle and/or its affiliates. */
/******************************************************************************
*
@ -46,6 +46,7 @@ describe('275. jsonDualityView4.js', function() {
isRunnable = (!dbConfig.test.drcp);
if (isRunnable) {
isRunnable = await testsUtil.checkPrerequisites(2300000000, 2300000000);
isRunnable = isRunnable && dbConfig.test.DBA_PRIVILEGE;
}
if (!isRunnable || dbConfig.test.isCmanTdm) {
this.skip();

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2023, Oracle and/or its affiliates. */
/* Copyright (c) 2023, 2024, Oracle and/or its affiliates. */
/******************************************************************************
*
@ -46,6 +46,7 @@ describe('276. jsonDualityView5.js', function() {
isRunnable = (!dbConfig.test.drcp);
if (isRunnable) {
isRunnable = await testsUtil.checkPrerequisites(2100000000, 2300000000);
isRunnable = isRunnable && dbConfig.test.DBA_PRIVILEGE;
}
if (!isRunnable || dbConfig.test.isCmanTdm) {
this.skip();
@ -100,9 +101,9 @@ describe('276. jsonDualityView5.js', function() {
after(async function() {
if (!isRunnable || dbConfig.test.isCmanTdm) return;
await connection.execute(testsUtil.sqlDropTable('student_class'));
await connection.execute(testsUtil.sqlDropTable('class'));
await connection.execute(testsUtil.sqlDropTable('student'));
await testsUtil.dropTable(connection, 'student_class');
await testsUtil.dropTable(connection, 'class');
await testsUtil.dropTable(connection, 'student');
await connection.close();
await dbaConn.execute(`drop user njs_jsonDv5 cascade`);

View File

@ -4853,7 +4853,7 @@ oracledb.OUT_FORMAT_OBJECT and resultSet = true
242.1.10 negative: set oracledb.dbObjectAsPojo to invalid value: null
242.1.11 negative: set oracledb.dbObjectAsPojo to invalid value: 0
242.1.12 negative: set oracledb.dbObjectAsPojo to invalid value: number
242.1.3 negative: set oracledb.dbObjectAsPojo to invalid value: string true
242.1.13 negative: set oracledb.dbObjectAsPojo to invalid value: string true
242.1.14 negative: set oracledb.dbObjectAsPojo to invalid value: string false
242.1.15 negative: set oracledb.dbObjectAsPojo to invalid value: undefined
242.1.16 negative: set oracledb.dbObjectAsPojo to invalid value: NaN

View File

@ -32,13 +32,13 @@
*****************************************************************************/
'use strict';
let random = exports;
const random = exports;
module.exports = random;
// generate a random string which length is 'length', with specialStr in it's head and tail
// generate a random string which length is 'length', with specialStr in its head and tail
random.getRandomString = function(length, specialStr) {
let str = '';
let strLength = length - specialStr.length * 2;
const strLength = length - specialStr.length * 2;
for (; str.length < strLength; str += Math.random().toString(36).slice(2));
str = str.slice(0, strLength);
str = specialStr + str + specialStr;
@ -53,7 +53,7 @@ random.getRandomLengthString = function(length) {
};
random.getRandomNumArray = function(size) {
let numbers = new Array(size);
const numbers = new Array(size);
for (let i = 0; i < numbers.length; i++) {
numbers[i] = this.getRandomInt(1, 9999999);
}
@ -67,9 +67,9 @@ random.getRandomInt = function(min, max) {
};
random.getIntArray = function(N) {
let arr = Array.apply(null, Array(N));
const arr = Array.apply(null, Array(N));
// The map() method creates a new array with the results of calling a provided function on every element in this array.
// var new_array = arr.map(callback[, thisArg])
// let new_array = arr.map(callback[, thisArg])
// Parameters
// callback
// Function that produces an element of the new Array, taking three arguments: