Skip to content

Commit 87a2341

Browse files
committed
Update tests after executeMany() and insertMany() error change
1 parent 54610cd commit 87a2341

File tree

3 files changed

+86
-31
lines changed

3 files changed

+86
-31
lines changed

test/executeMany2.js

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ describe('172. executeMany2.js', function() {
124124
}
125125
});
126126

127-
it('172.2.1 binding by position and by name cannot be mixed', async () => {
127+
it('172.2.1 Negative - Binding by position and by name cannot be mixed', async () => {
128128
let conn;
129129
try {
130130
conn = await oracledb.getConnection(dbconfig);
@@ -155,7 +155,7 @@ describe('172. executeMany2.js', function() {
155155
}
156156
});
157157

158-
it('172.2.2 Binding an array which values are undefined will throw ORA-01008', async function() {
158+
it('172.2.2 Negative - Binding an array which values are undefined will throw ORA-01008', async function() {
159159
let conn;
160160
try {
161161
conn = await oracledb.getConnection(dbconfig);
@@ -181,7 +181,7 @@ describe('172. executeMany2.js', function() {
181181
}
182182
});
183183

184-
it('172.2.3 Binding an array starts with undefined will throw ORA-01008', async function() {
184+
it('172.2.3 Negative - Binding an array starts with undefined will throw ORA-01008', async function() {
185185
let conn;
186186
try {
187187
conn = await oracledb.getConnection(dbconfig);
@@ -212,7 +212,7 @@ describe('172. executeMany2.js', function() {
212212
}
213213
});
214214

215-
it('172.2.4 Binding an array contains undefined will throw JS TypeError', async function() {
215+
it('172.2.4 Negative - Binding an array contains undefined will throw JS TypeError', async function() {
216216
let conn;
217217
try {
218218
conn = await oracledb.getConnection(dbconfig);
@@ -241,6 +241,49 @@ describe('172. executeMany2.js', function() {
241241
}
242242
}
243243
}
244-
});
245-
});
246-
});
244+
}); // 172.2.4
245+
246+
it('172.2.5 Negative - Bind an empty array', async () => {
247+
try {
248+
let conn = await oracledb.getConnection(dbconfig);
249+
250+
await testsUtil.assertThrowsAsync(
251+
async () => {
252+
await conn.executeMany(
253+
"insert into nodb_tab_emp values (:a, :b)",
254+
[]
255+
);
256+
},
257+
/NJS-005/
258+
);
259+
// NJS-005: invalid value for parameter 2
260+
261+
await conn.close();
262+
} catch (err) {
263+
should.not.exist(err);
264+
}
265+
}); // 172.2.5
266+
267+
it('172.2.6 Negative - Set number of ierations to 0', async () => {
268+
try {
269+
let conn = await oracledb.getConnection(dbconfig);
270+
271+
await testsUtil.assertThrowsAsync(
272+
async () => {
273+
await conn.executeMany(
274+
"insert into nodb_tab_emp values (:a, :b)",
275+
0
276+
);
277+
},
278+
/NJS-005/
279+
);
280+
// NJS-005: invalid value for parameter 2
281+
282+
await conn.close();
283+
} catch (err) {
284+
should.not.exist(err);
285+
}
286+
}); // 172.2.6
287+
288+
}); // 172.2
289+
});

test/list.txt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4235,17 +4235,15 @@ oracledb.OUT_FORMAT_OBJECT and resultSet = true
42354235
171.2 oracledb.fetchAsString
42364236
171.3 data bind
42374237

4238-
172. executeMany2.js
4239-
172.1 Negative - incorrect parameters
4240-
172.2 binding by position and by name cannot be mixed
4241-
4242-
172. executeMany2.js
4238+
72. executeMany2.js
42434239
172.1 Negative - incorrect parameters
42444240
172.2 Binding tests for invalid binding variables
4245-
172.2.1 binding by position and by name cannot be mixed
4246-
172.2.2 Binding an array which values are undefined will throw ORA-01008
4247-
172.2.3 Binding an array starts with undefined will throw ORA-01008
4248-
172.2.4 Binding an array contains undefined will throw JS TypeError
4241+
172.2.1 Negative - Bind by position and by name cannot be mixed
4242+
172.2.2 Negative - Bind an array which values are undefined will throw ORA-01008
4243+
172.2.3 Negative - Bind an array starts with undefined will throw ORA-01008
4244+
172.2.4 Negative - Bind an array contains undefined will throw JS TypeError
4245+
172.2.5 Negative - Bind an empty array
4246+
172.2.6 Negative - Set number of ierations to 0
42494247

42504248
173. soda5.js
42514249
173.1 create index, basic case
@@ -4314,7 +4312,8 @@ oracledb.OUT_FORMAT_OBJECT and resultSet = true
43144312
178.2 insertMany() with newSodaDocumentContentArray
43154313
178.3 insertManyAndGet() with newDocumentArray
43164314
178.4 insertManyAndGet() with newDocumentContentArray
4317-
- 174.5 Negative - insertMany() with empty array
4315+
174.5 Negative - insertMany() with an empty array
4316+
174.6 Negative - insertManyAndGet() with an empty array
43184317

43194318
179. soda11.js
43204319
179.1 create collection with metadata

test/soda10.js

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ describe('178. soda10.js', () => {
5656

5757
after(async function() {
5858
if (!runnable) {
59-
this.skip();
6059
return;
6160
}
6261
try {
@@ -195,24 +194,38 @@ describe('178. soda10.js', () => {
195194
}
196195
}); // 178.4
197196

198-
it.skip('174.5 Negative - insertMany() with empty array', async () => {
197+
it('174.5 Negative - insertMany() with an empty array', async () => {
199198
try {
200199
const COLL = "soda_test_178_5";
201200
const collection = await soda.createCollection(COLL);
202201

203-
// ORA-40673: arrayLength argument cannot be NULL.
204-
let inDocuments = [];
205-
await collection.insertMany(inDocuments);
202+
await testsUtil.assertThrowsAsync(
203+
async () => {
204+
await collection.insertMany( [] );
205+
},
206+
/NJS-005/
207+
);
206208

207-
// Fetch back
208-
let outDocuments = await collection.find().getDocuments();
209-
let outContents = [];
210-
for (let i = 0; i < outDocuments.length; i++) {
211-
outContents[i] = outDocuments[i].getContent(); // n.b. synchronous method
212-
}
209+
await conn.commit();
213210

214-
console.log(outContents);
215-
// should.deepEqual(outContents, inContents);
211+
let res = await collection.drop();
212+
should.strictEqual(res.dropped, true);
213+
} catch (err) {
214+
should.not.exist(err);
215+
}
216+
}); // 174.5
217+
218+
it('174.6 Negative - insertManyAndGet() with an empty array', async () => {
219+
try {
220+
const COLL = "soda_test_178_6";
221+
const collection = await soda.createCollection(COLL);
222+
223+
await testsUtil.assertThrowsAsync(
224+
async () => {
225+
await collection.insertManyAndGet( [] );
226+
},
227+
/NJS-005/
228+
);
216229

217230
await conn.commit();
218231

@@ -221,6 +234,6 @@ describe('178. soda10.js', () => {
221234
} catch (err) {
222235
should.not.exist(err);
223236
}
224-
}); // 174.5
237+
}); // 174.6
225238

226239
});

0 commit comments

Comments
 (0)