2013-09-08 15:57:32 -04:00
|
|
|
|
2013-09-05 16:36:49 -04:00
|
|
|
require("mocha-as-promised")();
|
2013-03-19 20:28:03 -04:00
|
|
|
|
2013-09-05 16:36:49 -04:00
|
|
|
global.sinon = require("sinon");
|
2013-05-04 02:57:12 -04:00
|
|
|
|
2013-09-05 16:36:49 -04:00
|
|
|
var chai = global.chai = require("chai");
|
|
|
|
chai.use(require("chai-as-promised"));
|
|
|
|
chai.use(require("sinon-chai"));
|
|
|
|
chai.should();
|
2013-06-09 13:50:43 -04:00
|
|
|
|
2013-09-05 16:36:49 -04:00
|
|
|
global._ = require('underscore');
|
2013-09-08 15:57:32 -04:00
|
|
|
global.whenResolve = require('when').resolve;
|
2013-09-05 16:36:49 -04:00
|
|
|
global.expect = chai.expect;
|
|
|
|
global.AssertionError = chai.AssertionError;
|
|
|
|
global.Assertion = chai.Assertion;
|
|
|
|
global.assert = chai.assert;
|
2013-03-19 20:28:03 -04:00
|
|
|
|
2013-09-08 15:57:32 -04:00
|
|
|
// Unit tests
|
|
|
|
describe('Unit Tests', function() {
|
2013-09-12 01:13:07 -04:00
|
|
|
require('./unit/knex');
|
|
|
|
require('./unit/common');
|
|
|
|
require('./unit/builder');
|
|
|
|
require('./unit/builder/joinclause');
|
|
|
|
require('./unit/raw');
|
|
|
|
require('./unit/transaction');
|
|
|
|
require('./unit/clients/base');
|
|
|
|
require('./unit/clients/base/grammar');
|
|
|
|
require('./unit/clients/base/schemagrammar');
|
|
|
|
require('./unit/clients/server/base');
|
|
|
|
require('./unit/clients/server/mysql');
|
|
|
|
require('./unit/clients/server/postgres');
|
|
|
|
require('./unit/clients/server/sqlite3');
|
2013-09-08 15:57:32 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
// Integration Tests
|
|
|
|
describe('Integration Tests', function() {
|
|
|
|
var Common = require('../lib/common').Common;
|
|
|
|
var Builder = require('../lib/builder').Builder;
|
|
|
|
var SchemaBuilder = require('../lib/schemabuilder').SchemaBuilder;
|
|
|
|
|
|
|
|
// This is where all of the info from the query calls goes...
|
|
|
|
var output = {};
|
|
|
|
|
|
|
|
before(function() {
|
|
|
|
var context = this;
|
2013-09-12 02:09:29 -04:00
|
|
|
|
2013-09-11 23:36:55 -04:00
|
|
|
SchemaBuilder.prototype.logMe = Builder.prototype.logMe = function(logWhat) {
|
|
|
|
this.isLogging = logWhat || true;
|
|
|
|
return this;
|
|
|
|
};
|
2013-09-12 02:09:29 -04:00
|
|
|
|
2013-09-08 15:57:32 -04:00
|
|
|
SchemaBuilder.prototype.then = Builder.prototype.then = function() {
|
2013-09-11 23:36:55 -04:00
|
|
|
|
|
|
|
if (this.isLogging) {
|
|
|
|
|
|
|
|
// If we're not only logging the sql for this query...
|
|
|
|
if (this.isLogging !== 'result') {
|
|
|
|
console.log(this.toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return Common.then.apply(this, arguments).tap(function() {
|
|
|
|
|
|
|
|
});
|
2013-09-08 15:57:32 -04:00
|
|
|
};
|
2013-09-11 23:36:55 -04:00
|
|
|
|
2013-09-08 15:57:32 -04:00
|
|
|
});
|
|
|
|
|
2013-09-11 23:36:55 -04:00
|
|
|
require('./integration/knex');
|
2013-09-08 15:57:32 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
// Benchmarks
|
|
|
|
describe('Benchmarks', function() {
|
|
|
|
|
|
|
|
|
|
|
|
});
|