2016-01-26 19:29:12 -05:00
|
|
|
'use strict';
|
|
|
|
|
2016-03-09 15:05:38 -05:00
|
|
|
(() => {
|
|
|
|
// Load the test base
|
|
|
|
const path = require('path');
|
|
|
|
const reload = require('require-reload')(require);
|
|
|
|
const testBase = reload('../base');
|
|
|
|
const promisify = require('../../lib/promisify');
|
|
|
|
const expect = reload('chai').expect;
|
|
|
|
const testRunner = testBase.testRunner;
|
|
|
|
const promiseTestRunner = testBase.promiseTestRunner;
|
2016-01-26 19:29:12 -05:00
|
|
|
|
2016-03-09 15:05:38 -05:00
|
|
|
// Load the test config file
|
|
|
|
let adapterName = 'node-firebird';
|
|
|
|
let Firebird = reload(adapterName);
|
|
|
|
const config = reload('../config.json')[adapterName];
|
2016-03-11 10:41:04 -05:00
|
|
|
config.connection.database = path.join(__dirname, config.connection.database);
|
|
|
|
let nodeQuery = reload('../../lib/NodeQuery')(config);
|
2016-01-26 19:29:12 -05:00
|
|
|
|
2016-03-11 10:41:04 -05:00
|
|
|
let qb = nodeQuery.getQuery();
|
2016-01-26 19:29:12 -05:00
|
|
|
|
2016-03-09 15:05:38 -05:00
|
|
|
// Skip on TravisCi
|
|
|
|
if (process.env.CI) {
|
|
|
|
return;
|
|
|
|
}
|
2016-01-26 19:29:12 -05:00
|
|
|
|
2016-03-11 10:41:04 -05:00
|
|
|
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');
|
|
|
|
});
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Callback Tests
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
testRunner(qb, (err, done) => {
|
|
|
|
expect(err).is.not.ok;
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Promise Tests
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
qb.adapter.execute(qb.driver.truncate('create_test')).then(() => {
|
|
|
|
promiseTestRunner(qb);
|
|
|
|
});
|
|
|
|
suiteTeardown(() => {
|
|
|
|
qb.end();
|
2016-02-12 11:40:21 -05:00
|
|
|
});
|
2016-01-26 19:29:12 -05:00
|
|
|
});
|
2016-03-09 15:05:38 -05:00
|
|
|
})();
|