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

Commit a50100d8 by Po-Ying Chen

rename the option, add test code

1 parent 54ff01f4
...@@ -265,9 +265,9 @@ module.exports = (function() { ...@@ -265,9 +265,9 @@ module.exports = (function() {
timezone: 'Z' timezone: 'Z'
}; };
if (config.nodeMysql) { if (config.connectionOptions) {
Object.keys(config.nodeMysql).forEach(function (key) { Object.keys(config.connectionOptions).forEach(function (key) {
connectionConfig[key] = config.nodeMysql[key]; connectionConfig[key] = config.connectionOptions[key];
}); });
} }
......
...@@ -103,7 +103,8 @@ module.exports = (function() { ...@@ -103,7 +103,8 @@ module.exports = (function() {
native : this.options.native, native : this.options.native,
replication: this.options.replication, replication: this.options.replication,
dialectModulePath: this.options.dialectModulePath, dialectModulePath: this.options.dialectModulePath,
maxConcurrentQueries: this.options.maxConcurrentQueries maxConcurrentQueries: this.options.maxConcurrentQueries,
connectionOptions: this.options.connectionOptions,
} }
try { try {
......
...@@ -101,14 +101,23 @@ describe(Support.getTestDialectTeaser("Configuration"), function() { ...@@ -101,14 +101,23 @@ describe(Support.getTestDialectTeaser("Configuration"), function() {
}) })
it('should accept four parameters (database, username, password, options)', function(done) { it('should accept four parameters (database, username, password, options)', function(done) {
var sequelize = new Sequelize('dbname', 'root', 'pass', { port: 999 }) var sequelize = new Sequelize('dbname', 'root', 'pass', {
port: 999,
connectionOptions: {
supportBigNumbers: true,
bigNumberStrings: true
}
})
var config = sequelize.config var config = sequelize.config
expect(config.database).to.equal('dbname') expect(config.database).to.equal('dbname')
expect(config.username).to.equal('root') expect(config.username).to.equal('root')
expect(config.password).to.equal('pass') expect(config.password).to.equal('pass')
expect(config.port).to.equal(999) expect(config.port).to.equal(999)
expect(config.connectionOptions.supportBigNumbers).to.be.true
expect(config.connectionOptions.bigNumberStrings).to.be.true
done() done()
}) })
}) })
}) })
...@@ -35,7 +35,8 @@ var Support = { ...@@ -35,7 +35,8 @@ var Support = {
logging: options.logging, logging: options.logging,
dialect: options.dialect, dialect: options.dialect,
port: options.port || process.env.SEQ_PORT || config[options.dialect].port, port: options.port || process.env.SEQ_PORT || config[options.dialect].port,
pool: options.pool pool: options.pool,
connectionOptions: options.connectionOptions || {}
} }
if (!!options.host) { if (!!options.host) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!