Skip to content

Commit 2153bef

Browse files
committed
Fix travis build, enable tests
1 parent 6b43b0f commit 2153bef

File tree

3 files changed

+50
-44
lines changed

3 files changed

+50
-44
lines changed

.travis.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
language: node_js
2+
sudo: required
3+
dist: xenial
24

35
node_js:
4-
- "9"
6+
- "10"
57
- "8"
68
- "6"
7-
9+
810
script:
911
- npm run lint-ci
1012
- npm run test-ci
1113

14+
env:
15+
- ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe ORACLE_SID=XE OCI_LIB_DIR=/u01/app/oracle/product/11.2.0/xe/lib LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/xe/lib
16+
17+
before_install:
18+
- wget https://raw.githubusercontent.com/Vincit/travis-oracledb-xe/master/accept_the_license_agreement_for_oracledb_xe_11g_and_install.sh
19+
- bash ./accept_the_license_agreement_for_oracledb_xe_11g_and_install.sh
20+
1221
notifications:
1322
email:
1423
on_success: never

test/client.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const plugin = require('../plugin')
77
test('accepts singleton client', (t) => {
88
t.plan(4)
99
oracledb.createPool({
10-
user: 'SYSTEM',
11-
password: 'oracle',
10+
user: 'travis',
11+
password: 'travis',
1212
connectString: 'localhost/XE'
1313
}, (err, pool) => {
1414
if (err) t.threw(err)
@@ -34,8 +34,8 @@ test('accepts singleton client', (t) => {
3434
test('retrieves a cached pool', (t) => {
3535
t.plan(4)
3636
oracledb.createPool({
37-
user: 'SYSTEM',
38-
password: 'oracle',
37+
user: 'travis',
38+
password: 'travis',
3939
connectString: 'localhost/XE',
4040
poolAlias: 'foo'
4141
}, (err, pool) => {

test/pool.test.js

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,41 @@
11
'use strict'
22

3-
// Unless someone can provide an Oracle Docker image to test against, we'll
4-
// just have to assume this works.
3+
const test = require('tap').test
4+
const plugin = require('../plugin')
55

6-
// const test = require('tap').test
7-
// const plugin = require('../plugin')
6+
test('creates usable pool from config', (t) => {
7+
t.plan(6)
88

9-
// test('creates usable pool from config', (t) => {
10-
// t.plan(6)
9+
const fastify = {
10+
decorate (name, obj) {
11+
t.is(name, 'oracle')
12+
this[name] = obj
13+
},
1114

12-
// const fastify = {
13-
// decorate (name, obj) {
14-
// t.is(name, 'oracle')
15-
// this[name] = obj
16-
// },
15+
addHook (name, fn) {
16+
t.is(name, 'onClose')
17+
t.match(fn, /fastify\.oracle\.close/)
18+
}
19+
}
1720

18-
// addHook (name, fn) {
19-
// t.is(name, 'onClose')
20-
// t.match(fn, /fastify\.oracle\.close/)
21-
// }
22-
// }
23-
24-
// const opts = {
25-
// user: 'SYSTEM',
26-
// password: 'oracle',
27-
// connectString: 'localhost/xe'
28-
// }
29-
// plugin(fastify, {pool: opts}, (err) => {
30-
// if (err) t.threw(err)
31-
// t.ok(fastify.oracle)
32-
// fastify.oracle.getConnection()
33-
// .then((conn) => {
34-
// conn.execute('select 1 as foo from dual')
35-
// .then((rows) => {
36-
// t.is(rows.length, 1)
37-
// t.is(rows[0].foo, 1)
38-
// })
39-
// .then(() => conn.close())
40-
// .catch(t.threw)
41-
// })
42-
// .catch(t.threw)
43-
// })
44-
// })
21+
const opts = {
22+
user: 'travis',
23+
password: 'travis',
24+
connectString: 'localhost/xe'
25+
}
26+
plugin(fastify, {pool: opts}, (err) => {
27+
if (err) t.threw(err)
28+
t.ok(fastify.oracle)
29+
fastify.oracle.getConnection()
30+
.then((conn) => {
31+
conn.execute('select 1 from dual')
32+
.then((result) => {
33+
t.is(result.rows.length, 1)
34+
t.is(result.rows[0][0], 1)
35+
})
36+
.then(() => conn.close())
37+
.catch(t.threw)
38+
})
39+
.catch(t.threw)
40+
})
41+
})

0 commit comments

Comments
 (0)