Completely promisify firebird driver
This commit is contained in:
parent
5dd42e07a7
commit
0ee092abd9
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const Adapter = require('../Adapter');
|
||||
const getArgs = require('getargs');
|
||||
const fb = require('node-firebird');
|
||||
|
||||
class Firebird extends Adapter {
|
||||
@ -29,7 +28,7 @@ class Firebird extends Adapter {
|
||||
execute (sql, params) {
|
||||
return this.instance.then(conn => {
|
||||
return new Promise((resolve, reject) => {
|
||||
conn.query(args.sql. args.params, (err, result) => {
|
||||
conn.query(sql, params, (err, result) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
|
@ -1,42 +1,40 @@
|
||||
'use strict';
|
||||
|
||||
(() => {
|
||||
// Load the test base
|
||||
const path = require('path');
|
||||
const reload = require('require-reload')(require);
|
||||
const testBase = reload('../base');
|
||||
const expect = reload('chai').expect;
|
||||
const testRunner = testBase.promiseTestRunner;
|
||||
// Load the test base
|
||||
const path = require('path');
|
||||
const reload = require('require-reload')(require);
|
||||
const testBase = reload('../base');
|
||||
const expect = testBase.expect;
|
||||
const testRunner = testBase.promiseTestRunner;
|
||||
|
||||
// Skip on CI
|
||||
if (process.env.CI || process.env.TRAVIS) {
|
||||
return;
|
||||
}
|
||||
// Skip on CI
|
||||
if (process.env.CI || process.env.TRAVIS) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load the test config file
|
||||
let adapterName = 'node-firebird';
|
||||
let Firebird = reload(adapterName);
|
||||
const config = reload('../config.json')[adapterName];
|
||||
config.connection.database = path.join(__dirname, config.connection.database);
|
||||
let nodeQuery = reload('../../lib/NodeQuery')(config);
|
||||
// Load the test config file
|
||||
let adapterName = 'node-firebird';
|
||||
let Firebird = reload(adapterName);
|
||||
const config = reload('../config.json')[adapterName];
|
||||
config.connection.database = path.join(__dirname, config.connection.database);
|
||||
let nodeQuery = reload('../../lib/NodeQuery')(config);
|
||||
|
||||
let qb = nodeQuery.getQuery();
|
||||
let qb = nodeQuery.getQuery();
|
||||
|
||||
suite('Firebird adapter tests -', () => {
|
||||
test('nodeQuery.getQuery = nodeQuery.init', () => {
|
||||
expect(nodeQuery.getQuery())
|
||||
.to.be.deep.equal(qb);
|
||||
});
|
||||
test('insertBatch throws error', () => {
|
||||
expect(() => {
|
||||
qb.driver.insertBatch('create_test', []);
|
||||
}).to.throw(Error, 'Not Implemented');
|
||||
});
|
||||
|
||||
testRunner(qb);
|
||||
|
||||
suiteTeardown(() => {
|
||||
qb.end();
|
||||
});
|
||||
suite('Firebird adapter tests -', () => {
|
||||
test('nodeQuery.getQuery = nodeQuery.init', () => {
|
||||
expect(nodeQuery.getQuery())
|
||||
.to.be.deep.equal(qb);
|
||||
});
|
||||
})();
|
||||
test('insertBatch throws error', () => {
|
||||
expect(() => {
|
||||
qb.driver.insertBatch('create_test', []);
|
||||
}).to.throw(Error, 'Not Implemented');
|
||||
});
|
||||
|
||||
testRunner(qb);
|
||||
|
||||
suiteTeardown(() => {
|
||||
qb.end();
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user