Skip to content

Commit aa5c949

Browse files
committed
Tests for connection class
1 parent 70ea7e5 commit aa5c949

File tree

3 files changed

+71
-2
lines changed

3 files changed

+71
-2
lines changed

test/connectionClass.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. */
2+
3+
/******************************************************************************
4+
*
5+
* You may not use the identified files except in compliance with the Apache
6+
* License, Version 2.0 (the "License.")
7+
*
8+
* You may obtain a copy of the License at
9+
* http://www.apache.org/licenses/LICENSE-2.0.
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
*
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
* NAME
19+
* 221. connectionClass.js
20+
*
21+
* DESCRIPTION
22+
* Test "oracledb.connectionClass".
23+
*
24+
*****************************************************************************/
25+
'use strict';
26+
27+
const oracledb = require('oracledb');
28+
const should = require('should');
29+
const dbconfig = require('./dbconfig.js');
30+
31+
describe('221. connectionClass.js', () => {
32+
33+
after(() => {
34+
oracledb.connectionClass = '';
35+
});
36+
37+
it('221.1 set the property when using a connection pool', async () => {
38+
try {
39+
oracledb.connectionClass = 'NODB_TEST';
40+
const pool = await oracledb.createPool(dbconfig);
41+
const conn = await pool.getConnection();
42+
43+
const result = await conn.execute('SELECT (1+4) FROM DUAL');
44+
should.strictEqual(result.rows[0][0], 5);
45+
46+
await conn.close();
47+
await pool.close();
48+
49+
} catch (err) {
50+
should.not.exist(err);
51+
}
52+
}); // 221.1
53+
54+
it.skip('221.2 set the property when using a standalone connection', async () => {
55+
try {
56+
oracledb.connectionClass = 'NODB_TEST';
57+
const conn = await oracledb.getConnection(dbconfig);
58+
59+
await conn.close();
60+
} catch (err) {
61+
should.not.exist(err);
62+
}
63+
}); // 221.2
64+
});

test/list.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4601,4 +4601,8 @@ oracledb.OUT_FORMAT_OBJECT and resultSet = true
46014601
219.7 enqMany() mixes enqueuing string and buffer
46024602

46034603
220. examineOwnedProperties.js
4604-
220.1 Only examine "owned" properties on objects
4604+
220.1 Only examine "owned" properties on objects
4605+
4606+
221. connectionClass.js
4607+
221.1 set the property when using a connection pool
4608+
221.2 set the property when using a standalone connection

test/opts/mocha.opts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,5 @@ test/aq1.js
245245
test/aq2.js
246246
test/aq3.js
247247

248-
test/examineOwnedProperties.js
248+
test/examineOwnedProperties.js
249+
test/connectionClass.js

0 commit comments

Comments
 (0)