node-query/tests/base_test.js

42 lines
1.2 KiB
JavaScript
Raw Normal View History

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");
});
test.done();
},
'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();
},
'Invalid driver type': function(test) {
test.expect(1);
test.throws(function() {
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();
}
};