不要怂,就是干,撸起袖子干!

Commit 8cb31290 by Willyham

Start adding tests

1 parent 971c1ab0
......@@ -19,7 +19,7 @@ ConnectionManager = function(dialect, sequelize) {
this.dialect = dialect;
if (config.pool) {
config.pool = _.extend({}, config.pool); // Make sure we don't modify the existing config object (user might re-use it)
config.pool = _.clone(config.pool); // Make sure we don't modify the existing config object (user might re-use it)
config.pool =_.defaults(config.pool, defaultPoolingConfig, {
validate: this.$validate.bind(this)
}) ;
......
'use strict';
var chai = require('chai')
, expect = chai.expect
, Support = require(__dirname + '/../../support')
, sinon = require('sinon')
, Config = require(__dirname + '/../../../config/config')
, ConnectionManager = require(__dirname + '/../../../../lib/dialects/abstract/connection-manager')
, Pooling = require('generic-pool');
chai.config.includeStack = true;
var baseConf = Config[Support.getTestDialect()];
describe('Connction Manager', function() {
var sandbox;
beforeEach(function(){
sandbox = sinon.sandbox.create();
});
afterEach(function(){
sandbox.restore();
});
it('should initialize a single pool without replication', function() {
var options = {
pool: {}
};
var sequelize = Support.getSequelizeInstance(baseConf.database, baseConf.username, baseConf.password, options);
var connectionManager = new ConnectionManager(Support.getTestDialect(), sequelize);
var poolSpy = sinon.spy(Pooling, "Pool");
connectionManager.initPools();
expect(poolSpy.calledOnce).to.be.true;
});
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!