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

Commit 0ce299eb by David Pate

Updated checks of error messages to use the new values which are what is propaga…

…ted from the connection failure.

As pointed out in the [PR](https://github.com/sequelize/sequelize/pull/2576#issuecomment-63018736) for this functionality we would ideally not be checking error messages and instead be checking the constructors of the objects to make sure that they are an instance of the correct error type. There's some issues right now with two different constructors being used and not being able to use `instanceof`. We could fall back to the constructor name or some other check, but at the end of the day that isn't really any better than just checking the message.
1 parent 2d844bea
......@@ -19,7 +19,7 @@ describe(Support.getTestDialectTeaser("Configuration"), function() {
var seq = new Sequelize(config[dialect].database, config[dialect].username, config[dialect].password, {storage: '/path/to/no/where/land', logging: false, host: '0.0.0.1', port: config[dialect].port, dialect: dialect})
seq.query('select 1 as hello').error(function(err) {
expect(err.message).to.match(/Failed to find (.*?) Please double check your settings\./)
expect(err.message).to.match(/connect EINVAL/)
done()
})
})
......@@ -33,7 +33,7 @@ describe(Support.getTestDialectTeaser("Configuration"), function() {
var seq = new Sequelize(config[dialect].database, config[dialect].username, 'fakepass123', {logging: false, host: config[dialect].host, port: 1, dialect: dialect})
seq.query('select 1 as hello').error(function(err) {
expect(err.message).to.match(/^Failed to authenticate/)
expect(err.message).to.match(/connect ECONNREFUSED/)
done()
})
})
......
......@@ -104,7 +104,7 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
})
})
it('triggers the actual adapter error', function(done) {
it.only('triggers the actual adapter error', function(done) {
this
.sequelizeWithInvalidConnection
......@@ -114,11 +114,11 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
expect(err.message).to.match(/Access denied for user/)
} else if (dialect === 'postgres') {
expect(
err.message.match(/Failed to authenticate for PostgresSQL/) ||
err.message.match(/connect ECONNREFUSED/) ||
err.message.match(/invalid port number/)
).to.be.ok
} else {
expect(err.message).to.match(/Failed to authenticate/)
expect(err.message).to.match(/connect ECONNREFUSED/)
}
done()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!