Revise test/fetchRowidAsString.js by removing oversized raw column test

This commit is contained in:
Christopher Jones 2019-03-23 07:58:36 +11:00 committed by Christopher Jones
parent 4e630baa30
commit b15e0567bc
2 changed files with 186 additions and 224 deletions

View File

@ -76,39 +76,6 @@ describe('188. fetchRowidAsString.js', function() {
before(async function() {
try {
conn = await oracledb.getConnection(dbConfig);
} catch (err) {
should.not.exist(err);
}
});
after(async function() {
try {
const sqlDropTable = `BEGIN \n` +
` DECLARE \n` +
` e_table_missing EXCEPTION; \n` +
` PRAGMA EXCEPTION_INIT(e_table_missing, -00942);\n` +
` BEGIN \n` +
` EXECUTE IMMEDIATE ('DROP TABLE ${tableName} PURGE' ); \n` +
` EXCEPTION \n` +
` WHEN e_table_missing \n` +
` THEN NULL; \n` +
` END; \n` +
`END; `;
await conn.execute(sqlDropTable);
await conn.close();
} catch (err) {
should.not.exist(err);
}
});
afterEach(function() {
oracledb.fetchAsString = [];
});
describe("188.1 Normal Use Cases", function() {
before(async function() {
try {
const sqlCreateTable = `BEGIN \n` +
` DECLARE \n` +
` e_table_missing EXCEPTION; \n` +
@ -146,7 +113,31 @@ describe('188. fetchRowidAsString.js', function() {
}
});
it("188.1.1 Fetch RAW by default should be oracledb.BUFFER type", async function() {
after(async function() {
try {
const sqlDropTable = `BEGIN \n` +
` DECLARE \n` +
` e_table_missing EXCEPTION; \n` +
` PRAGMA EXCEPTION_INIT(e_table_missing, -00942);\n` +
` BEGIN \n` +
` EXECUTE IMMEDIATE ('DROP TABLE ${tableName} PURGE' ); \n` +
` EXCEPTION \n` +
` WHEN e_table_missing \n` +
` THEN NULL; \n` +
` END; \n` +
`END; `;
await conn.execute(sqlDropTable);
await conn.close();
} catch (err) {
should.not.exist(err);
}
});
afterEach(function() {
oracledb.fetchAsString = [];
});
it("188.1 Fetch RAW by default should be oracledb.BUFFER type", async function() {
try {
let res = await conn.execute(`select raw_content from ${tableName} where content_type='string'`);
should.exist(res.rows);
@ -159,7 +150,7 @@ describe('188. fetchRowidAsString.js', function() {
}
});
it("188.1.2 Fetch RAW as string by defining fetchAsString", async function() {
it("188.2 Fetch RAW as string by defining fetchAsString", async function() {
try {
oracledb.fetchAsString = [oracledb.BUFFER];
let res = await conn.execute(`select raw_content from ${tableName} where content_type='string'`);
@ -173,7 +164,7 @@ describe('188. fetchRowidAsString.js', function() {
}
});
it("188.1.3 Fetch RAW as string by defining fetchInfo", async function() {
it("188.3 Fetch RAW as string by defining fetchInfo", async function() {
try {
oracledb.fetchAsString = [];
let res = await conn.execute(
@ -190,7 +181,7 @@ describe('188. fetchRowidAsString.js', function() {
}
});
it("188.1.4 Fetch number converted RAW as string", async function() {
it("188.4 Fetch number converted RAW as string", async function() {
try {
oracledb.fetchAsString = [oracledb.BUFFER];
let res = await conn.execute(`select raw_content from ${tableName} where content_type='number'`);
@ -204,7 +195,7 @@ describe('188. fetchRowidAsString.js', function() {
}
});
it("188.1.5 Fetch binary double converted RAW as string", async function() {
it("188.5 Fetch binary double converted RAW as string", async function() {
try {
oracledb.fetchAsString = [oracledb.BUFFER];
let res = await conn.execute(`select raw_content from ${tableName} where content_type='binary_double'`);
@ -218,7 +209,7 @@ describe('188. fetchRowidAsString.js', function() {
}
});
it("188.1.6 Fetch binary float converted RAW as string", async function() {
it("188.6 Fetch binary float converted RAW as string", async function() {
try {
oracledb.fetchAsString = [oracledb.BUFFER];
let res = await conn.execute(`select raw_content from ${tableName} where content_type='binary_float'`);
@ -232,7 +223,7 @@ describe('188. fetchRowidAsString.js', function() {
}
});
it("188.1.7 Fetch binary integer converted RAW as string", async function() {
it("188.7 Fetch binary integer converted RAW as string", async function() {
try {
oracledb.fetchAsString = [oracledb.BUFFER];
let res = await conn.execute(`select raw_content from ${tableName} where content_type='binary_integer'`);
@ -246,7 +237,7 @@ describe('188. fetchRowidAsString.js', function() {
}
});
it("188.1.8 Insert a string of maximum lenght of RAW then fetch it as string", async function() {
it("188.8 Insert a string of maximum lenght of RAW then fetch it as string", async function() {
try {
oracledb.fetchAsString = [oracledb.BUFFER];
let res = await conn.execute(`select raw_content from ${tableName} where content_type='max_length_string'`);
@ -260,7 +251,7 @@ describe('188. fetchRowidAsString.js', function() {
}
});
it("188.1.9 Insert a string exceeds maximum lenght of RAW", async function() {
it("188.9 Insert a string exceeds maximum lenght of RAW", async function() {
try {
let contentString = random.getRandomLengthString(rawMaxLength+1);
const sql = `INSERT INTO ${tableName} VALUES(utl_raw.cast_to_raw('${contentString}'), 'string')`;
@ -273,7 +264,7 @@ describe('188. fetchRowidAsString.js', function() {
}
});
it("188.1.10 Insert null to RAW column then fetch it as string", async function() {
it("188.10 Insert null to RAW column then fetch it as string", async function() {
try {
const sql = `INSERT INTO ${tableName} VALUES(null, 'null')`;
await conn.execute(sql);
@ -287,37 +278,5 @@ describe('188. fetchRowidAsString.js', function() {
should.not.exist(err);
}
});
});
describe("188.2 Boundary Cases", function() {
it("188.2.1 Creating table specifing length greater than RAW max limit", async function() {
try {
const sql_create_table = `BEGIN \n` +
` DECLARE \n` +
` e_table_missing EXCEPTION; \n` +
` PRAGMA EXCEPTION_INIT(e_table_missing, -00942);\n` +
` BEGIN \n` +
` EXECUTE IMMEDIATE ('DROP TABLE ${tableName} PURGE' ); \n` +
` EXCEPTION \n` +
` WHEN e_table_missing \n` +
` THEN NULL; \n` +
` END; \n` +
` EXECUTE IMMEDIATE ( ' \n` +
` CREATE TABLE ${tableName} ( \n` +
` raw_content RAW(2001), \n` +
` content_type VARCHAR(20) \n` +
` ) \n` +
` '); \n` +
`END; `;
await testUtil.assertThrowsAsync(async () => {
await conn.execute(sql_create_table);
}, /ORA-00910:/); // ORA-00910: specified length too long for its datatype
} catch (err) {
should.not.exist(err);
}
});
});
});

View File

@ -265,7 +265,7 @@ Overview of node-oracledb functional tests
12.3.11 Negative - set the 1st parameter of getRows() to be -5
12.3.12 Negative - set the 1st parameter of getRows() to be null
12.4 Testing function getRow()
12.4.1 works well with all correct setting (39ms)
12.4.1 works well with all correct setting
12.4.2 data in resultSet is array when setting outFormat ARRAY
12.4.3 data in resultSet is object when setting outFormat OBJECT
12.4.4 query 0 row
@ -2027,7 +2027,7 @@ Overview of node-oracledb functional tests
88.1.3 works with small value
88.1.4 works with (64K - 1) value
88.1.5 works with (64K + 1) value
88.1.6 works with (1MB + 1) value (121ms)
88.1.6 works with (1MB + 1) value
88.1.7 works with dbms_lob.substr()
88.1.8 works with EMPTY_BLOB()
88.1.9 fetch multiple BLOB rows as Buffer
@ -4398,6 +4398,7 @@ Overview of node-oracledb functional tests
184.4.9 Close connection from pool with {drop: 0}
184.4.10 Close connection from pool with empty dict
184.4.11 Close connection from pool with {drop: random string}
185. cqn.js
185.1 Positive Cases
185.1.1 Register simple callback and unsubscribe
@ -4418,8 +4419,10 @@ Overview of node-oracledb functional tests
185.2 Negative Cases
185.2.1 Does not throw error when trying to unsubscribe twice
185.2.2 Throw error ORA-29972 if CHANGE NOTIFICATION is revoked from the user
186. instanceof2.js
186.1 instanceof checks for SODA classes
187. plsqlBindList.js
187.1 Positive Cases
187.1.1 Bind Object of List by position with type specified
@ -4439,26 +4442,26 @@ Overview of node-oracledb functional tests
187.2.8 Bind STRING List by position while required type is NUMBER
187.2.9 Bind NUMBER List by name while required type is STRING
187.2.10 Bind NUMBER List by position while required type is STRING
188. fetchRowidAsString.js
188.1 Normal Use Cases
188.1.1 Fetch RAW by default should be oracledb.BUFFER type
188.1.2 Fetch RAW as string by defining fetchAsString
188.1.3 Fetch RAW as string by defining fetchInfo
188.1.4 Fetch number converted RAW as string
188.1.5 Fetch binary double converted RAW as string
188.1.6 Fetch binary float converted RAW as string
188.1.7 Fetch binary integer converted RAW as string
188.1.8 Insert a string of maximum lenght of RAW then fetch it as string
188.1.9 Insert a string exceeds maximum lenght of RAW
188.1.10 Insert null to RAW column then fetch it as string
188.2 Boundary Cases
188.2.1 Creating table specifing length greater than RAW max limit
188.1 Fetch RAW by default should be oracledb.BUFFER type
188.2 Fetch RAW as string by defining fetchAsString
188.3 Fetch RAW as string by defining fetchInfo
188.4 Fetch number converted RAW as string
188.5 Fetch binary double converted RAW as string
188.6 Fetch binary float converted RAW as string
188.7 Fetch binary integer converted RAW as string
188.8 Insert a string of maximum lenght of RAW then fetch it as string
188.9 Insert a string exceeds maximum lenght of RAW
188.10 Insert null to RAW column then fetch it as string
189. writableProperties2.js
189.1 Allows overwriting of public methods on SodaDatabase instance
189.2 Allows overwriting of public methods on SodaDocument instance
189.3 Allows overwriting of public methods on SodaCollection instance
189.4 Allows overwriting of public methods on SodaOperation instance
189.5 Allows overwriting of public methods on SodaDocCursor instance
190. fetchBinaryTypesAsString.js
190.1 Fetch binary double
190.1.1 Fetch binary double should return JS number