2014-10-20 16:56:45 -04:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var modules = {
|
|
|
|
helpers: require('../lib/helpers'),
|
|
|
|
driver: require('../lib/driver'),
|
|
|
|
qb: require('../lib/query-builder'),
|
2014-10-23 10:53:16 -04:00
|
|
|
'node-query': require('../lib/node-query'),
|
2015-01-27 10:17:19 -05:00
|
|
|
'state': require('../lib/state'),
|
2014-10-23 10:53:16 -04:00
|
|
|
'drivers/pg': require('../lib/drivers/pg'),
|
|
|
|
'drivers/mysql': require('../lib/drivers/mysql'),
|
2014-10-31 11:57:44 -04:00
|
|
|
'drivers/sqlite': require('../lib/drivers/sqlite'),
|
|
|
|
'adapters/mysql': require('../lib/adapters/mysql'),
|
|
|
|
'adapters/mysql2': require('../lib/adapters/mysql2'),
|
|
|
|
'adapters/pg': require('../lib/adapters/pg'),
|
|
|
|
'adapters/dblite': require('../lib/adapters/dblite')
|
2014-10-20 16:56:45 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
'Sanity check': function (test) {
|
|
|
|
test.expect(modules.length);
|
|
|
|
|
|
|
|
Object.keys(modules).forEach(function(mod) {
|
|
|
|
test.ok(modules[mod], mod + " module is sane");
|
|
|
|
});
|
|
|
|
|
2014-10-28 16:46:48 -04:00
|
|
|
test.done();
|
|
|
|
},
|
2014-11-05 17:08:56 -05:00
|
|
|
'NodeQuery.getQuery with no instance': function(test) {
|
|
|
|
test.expect(1);
|
|
|
|
test.throws(function() {
|
|
|
|
nodeQuery.getQuery();
|
|
|
|
}, Error, "No query builder instance if none created");
|
|
|
|
test.done();
|
|
|
|
},
|
2014-10-28 16:46:48 -04:00
|
|
|
'Invalid driver type': function(test) {
|
|
|
|
test.expect(1);
|
|
|
|
test.throws(function() {
|
2014-11-05 17:08:56 -05:00
|
|
|
nodeQuery.init('foo', {}, 'bar');
|
2014-10-30 09:48:03 -04:00
|
|
|
}, Error, "Bad driver throws exception");
|
2014-10-20 16:56:45 -04:00
|
|
|
test.done();
|
|
|
|
}
|
|
|
|
};
|