Optimize test cases
This commit is contained in:
parent
b0aa428388
commit
aba59f4496
|
@ -50,7 +50,7 @@ describe('162. getStmtInfo.js', function() {
|
|||
});
|
||||
|
||||
after(async function() {
|
||||
await testsUtil.dropTable(tableName);
|
||||
await testsUtil.dropTable(conn, tableName);
|
||||
await conn.close();
|
||||
});
|
||||
|
||||
|
@ -173,7 +173,7 @@ describe('162. getStmtInfo.js', function() {
|
|||
}); // 162.13
|
||||
|
||||
it('162.14 CREATE and verify the data does not get created', async function() {
|
||||
await testsUtil.dropTable("nodb_test_162_14");
|
||||
await testsUtil.dropTable(conn, "nodb_test_162_14");
|
||||
let sql = "create table nodb_test_162_14 (a number)";
|
||||
const info = await conn.getStatementInfo(sql);
|
||||
assert.deepStrictEqual(info.bindNames, []);
|
||||
|
@ -186,7 +186,7 @@ describe('162. getStmtInfo.js', function() {
|
|||
}); // 162.14
|
||||
|
||||
it('162.15 CREATE procedure', async function() {
|
||||
await testsUtil.dropSource("procedure", "nodb_proc_162_15");
|
||||
await testsUtil.dropSource(conn, "procedure", "nodb_proc_162_15");
|
||||
let proc = "CREATE OR REPLACE PROCEDURE nodb_proc_162_15 (str OUT STRING) \n" +
|
||||
"AS \n" +
|
||||
"BEGIN \n" +
|
||||
|
|
|
@ -53,8 +53,8 @@ describe('228. lastRowid.js', function() {
|
|||
});
|
||||
|
||||
after(async () => {
|
||||
await testsUtil.dropTable(conn, TABLE);
|
||||
await conn.close();
|
||||
await testsUtil.dropTable(TABLE);
|
||||
});
|
||||
|
||||
it('228.1 examples', async () => {
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
const oracledb = require('oracledb');
|
||||
const assert = require('assert');
|
||||
const dbConfig = require('./dbconfig.js');
|
||||
const testsUtil = require('./testsUtil.js');
|
||||
|
||||
describe('2. pool.js', function() {
|
||||
|
||||
|
@ -546,7 +547,7 @@ describe('2. pool.js', function() {
|
|||
it('2.11.1 error occurs at creating pool when poolMin (user defined) greater than or equal to poolMax (default)', async function() {
|
||||
const config = {
|
||||
user: 'notexist',
|
||||
password: 'nopass',
|
||||
password: testsUtil.generateRandomPassword(),
|
||||
connectString: dbConfig.connectString,
|
||||
poolMin: 5
|
||||
};
|
||||
|
@ -560,7 +561,7 @@ describe('2. pool.js', function() {
|
|||
const config = {
|
||||
...dbConfig,
|
||||
user: 'notexist',
|
||||
password: 'nopass',
|
||||
password: testsUtil.generateRandomPassword()
|
||||
};
|
||||
const pool = await oracledb.createPool(config);
|
||||
await assert.rejects(
|
||||
|
@ -878,7 +879,7 @@ describe('2. pool.js', function() {
|
|||
poolMax: 1,
|
||||
poolIncrement: 0,
|
||||
externalAuth: true,
|
||||
password: 'nopass'
|
||||
password: testsUtil.generateRandomPassword()
|
||||
};
|
||||
await assert.rejects(
|
||||
async () => await oracledb.createPool(config),
|
||||
|
|
|
@ -93,25 +93,19 @@ testsUtil.sqlDropType = function(typeName) {
|
|||
`;
|
||||
};
|
||||
|
||||
testsUtil.createTable = async function(tableName, sql) {
|
||||
let plsql = testsUtil.sqlCreateTable(tableName, sql);
|
||||
const conn = await oracledb.getConnection(dbConfig);
|
||||
testsUtil.createTable = async function(conn, tableName, sql) {
|
||||
const plsql = testsUtil.sqlCreateTable(tableName, sql);
|
||||
await conn.execute(plsql);
|
||||
await conn.close();
|
||||
};
|
||||
|
||||
testsUtil.dropSource = async function(sourceType, sourceName) {
|
||||
let plsql = testsUtil.sqlDropSource(sourceType, sourceName);
|
||||
const conn = await oracledb.getConnection(dbConfig);
|
||||
testsUtil.dropSource = async function(conn, sourceType, sourceName) {
|
||||
const plsql = testsUtil.sqlDropSource(sourceType, sourceName);
|
||||
await conn.execute(plsql);
|
||||
await conn.close();
|
||||
};
|
||||
|
||||
testsUtil.dropTable = async function(tableName) {
|
||||
let plsql = testsUtil.sqlDropTable(tableName);
|
||||
const conn = await oracledb.getConnection(dbConfig);
|
||||
testsUtil.dropTable = async function(conn, tableName) {
|
||||
const plsql = testsUtil.sqlDropTable(tableName);
|
||||
await conn.execute(plsql);
|
||||
await conn.close();
|
||||
};
|
||||
|
||||
testsUtil.checkPrerequisites = async function(clientVersion = 1805000000, serverVersion = 1805000000) {
|
||||
|
|
|
@ -75,7 +75,9 @@ describe('260. tpcResume.js', function() {
|
|||
});
|
||||
|
||||
after(async function() {
|
||||
await testsUtil.dropTable("nodb_tpc_resume");
|
||||
const connection = await oracledb.getConnection(dbConfig);
|
||||
await testsUtil.dropTable(connection, "nodb_tpc_resume");
|
||||
await connection.close();
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue