Update tests after executeMany() and insertMany() error change

This commit is contained in:
Christopher Jones 2019-07-15 10:55:01 +10:00
parent 6d86cb8fb5
commit 6e31208584
3 changed files with 87 additions and 32 deletions

View File

@ -124,7 +124,7 @@ describe('172. executeMany2.js', function() {
}
});
it('172.2.1 binding by position and by name cannot be mixed', async () => {
it('172.2.1 Negative - Binding by position and by name cannot be mixed', async () => {
let conn;
try {
conn = await oracledb.getConnection(dbconfig);
@ -155,7 +155,7 @@ describe('172. executeMany2.js', function() {
}
});
it('172.2.2 Binding an array which values are undefined will throw ORA-01008', async function() {
it('172.2.2 Negative - Binding an array which values are undefined will throw ORA-01008', async function() {
let conn;
try {
conn = await oracledb.getConnection(dbconfig);
@ -181,7 +181,7 @@ describe('172. executeMany2.js', function() {
}
});
it('172.2.3 Binding an array starts with undefined will throw ORA-01008', async function() {
it('172.2.3 Negative - Binding an array starts with undefined will throw ORA-01008', async function() {
let conn;
try {
conn = await oracledb.getConnection(dbconfig);
@ -212,7 +212,7 @@ describe('172. executeMany2.js', function() {
}
});
it('172.2.4 Binding an array contains undefined will throw JS TypeError', async function() {
it('172.2.4 Negative - Binding an array contains undefined will throw JS TypeError', async function() {
let conn;
try {
conn = await oracledb.getConnection(dbconfig);
@ -241,6 +241,49 @@ describe('172. executeMany2.js', function() {
}
}
}
});
});
});
}); // 172.2.4
it('172.2.5 Negative - Bind an empty array', async () => {
try {
let conn = await oracledb.getConnection(dbconfig);
await testsUtil.assertThrowsAsync(
async () => {
await conn.executeMany(
"insert into nodb_tab_emp values (:a, :b)",
[]
);
},
/NJS-005/
);
// NJS-005: invalid value for parameter 2
await conn.close();
} catch (err) {
should.not.exist(err);
}
}); // 172.2.5
it('172.2.6 Negative - Set number of ierations to 0', async () => {
try {
let conn = await oracledb.getConnection(dbconfig);
await testsUtil.assertThrowsAsync(
async () => {
await conn.executeMany(
"insert into nodb_tab_emp values (:a, :b)",
0
);
},
/NJS-005/
);
// NJS-005: invalid value for parameter 2
await conn.close();
} catch (err) {
should.not.exist(err);
}
}); // 172.2.6
}); // 172.2
});

View File

@ -4235,17 +4235,15 @@ oracledb.OUT_FORMAT_OBJECT and resultSet = true
171.2 oracledb.fetchAsString
171.3 data bind
172. executeMany2.js
172.1 Negative - incorrect parameters
172.2 binding by position and by name cannot be mixed
172. executeMany2.js
72. executeMany2.js
172.1 Negative - incorrect parameters
172.2 Binding tests for invalid binding variables
172.2.1 binding by position and by name cannot be mixed
172.2.2 Binding an array which values are undefined will throw ORA-01008
172.2.3 Binding an array starts with undefined will throw ORA-01008
172.2.4 Binding an array contains undefined will throw JS TypeError
172.2.1 Negative - Bind by position and by name cannot be mixed
172.2.2 Negative - Bind an array which values are undefined will throw ORA-01008
172.2.3 Negative - Bind an array starts with undefined will throw ORA-01008
172.2.4 Negative - Bind an array contains undefined will throw JS TypeError
172.2.5 Negative - Bind an empty array
172.2.6 Negative - Set number of ierations to 0
173. soda5.js
173.1 create index, basic case
@ -4314,7 +4312,8 @@ oracledb.OUT_FORMAT_OBJECT and resultSet = true
178.2 insertMany() with newSodaDocumentContentArray
178.3 insertManyAndGet() with newDocumentArray
178.4 insertManyAndGet() with newDocumentContentArray
- 174.5 Negative - insertMany() with empty array
174.5 Negative - insertMany() with an empty array
174.6 Negative - insertManyAndGet() with an empty array
179. soda11.js
179.1 create collection with metadata

View File

@ -56,7 +56,6 @@ describe('178. soda10.js', () => {
after(async function() {
if (!runnable) {
this.skip();
return;
}
try {
@ -195,24 +194,17 @@ describe('178. soda10.js', () => {
}
}); // 178.4
it.skip('174.5 Negative - insertMany() with empty array', async () => {
it('174.5 Negative - insertMany() with an empty array', async () => {
try {
const COLL = "soda_test_178_5";
const collection = await soda.createCollection(COLL);
// ORA-40673: arrayLength argument cannot be NULL.
let inDocuments = [];
await collection.insertMany(inDocuments);
// Fetch back
let outDocuments = await collection.find().getDocuments();
let outContents = [];
for (let i = 0; i < outDocuments.length; i++) {
outContents[i] = outDocuments[i].getContent(); // n.b. synchronous method
}
console.log(outContents);
// should.deepEqual(outContents, inContents);
await testsUtil.assertThrowsAsync(
async () => {
await collection.insertMany( [] );
},
/NJS-005/
);
await conn.commit();
@ -223,4 +215,25 @@ describe('178. soda10.js', () => {
}
}); // 174.5
it('174.6 Negative - insertManyAndGet() with an empty array', async () => {
try {
const COLL = "soda_test_178_6";
const collection = await soda.createCollection(COLL);
await testsUtil.assertThrowsAsync(
async () => {
await collection.insertManyAndGet( [] );
},
/NJS-005/
);
await conn.commit();
let res = await collection.drop();
should.strictEqual(res.dropped, true);
} catch (err) {
should.not.exist(err);
}
}); // 174.6
});