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

Commit 70910476 by Sushant

test(mysql): remove old warning tests

1 parent d76b0a84
...@@ -22,7 +22,7 @@ describe(Support.getTestDialectTeaser('Warning'), () => { ...@@ -22,7 +22,7 @@ describe(Support.getTestDialectTeaser('Warning'), () => {
const Model = sequelize.define('model', { const Model = sequelize.define('model', {
name: Sequelize.DataTypes.STRING(1, true) name: Sequelize.DataTypes.STRING(1, true)
}); });
return sequelize.sync({ force: true }).then(() => { return sequelize.sync({ force: true }).then(() => {
return sequelize.authenticate(); return sequelize.authenticate();
}).then(() => { }).then(() => {
...@@ -40,4 +40,4 @@ describe(Support.getTestDialectTeaser('Warning'), () => { ...@@ -40,4 +40,4 @@ describe(Support.getTestDialectTeaser('Warning'), () => {
}); });
}); });
} }
}); });
\ No newline at end of file \ No newline at end of file
...@@ -13,10 +13,8 @@ const chai = require('chai'), ...@@ -13,10 +13,8 @@ const chai = require('chai'),
Transaction = require('../../lib/transaction'), Transaction = require('../../lib/transaction'),
logger = require('../../lib/utils/logger'), logger = require('../../lib/utils/logger'),
sinon = require('sinon'), sinon = require('sinon'),
semver = require('semver'),
current = Support.sequelize; current = Support.sequelize;
const qq = function(str) { const qq = function(str) {
if (dialect === 'postgres' || dialect === 'mssql') { if (dialect === 'postgres' || dialect === 'mssql') {
return '"' + str + '"'; return '"' + str + '"';
...@@ -287,33 +285,6 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => { ...@@ -287,33 +285,6 @@ describe(Support.getTestDialectTeaser('Sequelize'), () => {
}); });
}); });
// We can only test MySQL warnings when using MySQL.
if (dialect === 'mysql') {
it('logs warnings when there are warnings', function() {
// Due to strict MySQL 5.7 all cases below will throw errors rather than warnings
if (semver.gte(current.options.databaseVersion, '5.6.0')) {
return;
}
const logger = sinon.spy();
const sequelize = Support.createSequelizeInstance({
logging: logger,
benchmark: false,
showWarnings: true
});
const insertWarningQuery = 'INSERT INTO ' + qq(this.User.tableName) + ' (username, email_address, ' +
qq('createdAt') + ', ' + qq('updatedAt') +
") VALUES ('john', 'john@gmail.com', 'HORSE', '2012-01-01 10:10:10')";
return sequelize.query(insertWarningQuery)
.then(() => {
expect(logger.callCount).to.equal(3);
expect(logger.args[2][0]).to.be.match(/^MySQL Warnings \(default\):.*?'createdAt'/m);
});
});
}
it('executes a query with global benchmarking option and custom logger', () => { it('executes a query with global benchmarking option and custom logger', () => {
const logger = sinon.spy(); const logger = sinon.spy();
const sequelize = Support.createSequelizeInstance({ const sequelize = Support.createSequelizeInstance({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!