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

Commit ee509090 by Ruben Bridgewater

Fix deprecation message in tests

1 parent 2a7c7c73
...@@ -22,8 +22,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -22,8 +22,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
this.User = this.sequelize.define('User', { username: DataTypes.STRING }); this.User = this.sequelize.define('User', { username: DataTypes.STRING });
this.Task = this.sequelize.define('Task', { title: DataTypes.STRING, active: DataTypes.BOOLEAN }); this.Task = this.sequelize.define('Task', { title: DataTypes.STRING, active: DataTypes.BOOLEAN });
this.User.belongsToMany(this.Task); this.User.belongsToMany(this.Task, { through: 'UserTasks' });
this.Task.belongsToMany(this.User); this.Task.belongsToMany(this.User, { through: 'UserTasks' });
return this.sequelize.sync({ force: true }).then(function() { return this.sequelize.sync({ force: true }).then(function() {
return Promise.all([ return Promise.all([
...@@ -54,8 +54,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -54,8 +54,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
this.Article = sequelize.define('Article', { 'title': DataTypes.STRING }); this.Article = sequelize.define('Article', { 'title': DataTypes.STRING });
this.Label = sequelize.define('Label', { 'text': DataTypes.STRING }); this.Label = sequelize.define('Label', { 'text': DataTypes.STRING });
this.Article.belongsToMany(this.Label); this.Article.belongsToMany(this.Label, { through: 'ArticleLabels' });
this.Label.belongsToMany(this.Article); this.Label.belongsToMany(this.Article, { through: 'ArticleLabels' });
return sequelize.sync({ force: true }); return sequelize.sync({ force: true });
}).then(function() { }).then(function() {
...@@ -417,8 +417,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -417,8 +417,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
var User = this.sequelize.define('User', { username: DataTypes.STRING }) var User = this.sequelize.define('User', { username: DataTypes.STRING })
, Task = this.sequelize.define('Task', { title: DataTypes.STRING }); , Task = this.sequelize.define('Task', { title: DataTypes.STRING });
User.belongsToMany(Task); User.belongsToMany(Task, { through: 'UserTasks' });
Task.belongsToMany(User); Task.belongsToMany(User, { through: 'UserTasks' });
return this.sequelize.sync({ force: true }).then(function() { return this.sequelize.sync({ force: true }).then(function() {
return Promise.all([ return Promise.all([
...@@ -445,8 +445,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -445,8 +445,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
var User = this.sequelize.define('User', { uid: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true }, username: DataTypes.STRING }) var User = this.sequelize.define('User', { uid: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true }, username: DataTypes.STRING })
, Task = this.sequelize.define('Task', { tid: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true }, title: DataTypes.STRING }); , Task = this.sequelize.define('Task', { tid: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true }, title: DataTypes.STRING });
User.belongsToMany(Task); User.belongsToMany(Task, { through: 'UserTasks' });
Task.belongsToMany(User); Task.belongsToMany(User, { through: 'UserTasks' });
return this.sequelize.sync({ force: true }).then(function() { return this.sequelize.sync({ force: true }).then(function() {
return Promise.all([ return Promise.all([
...@@ -503,8 +503,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -503,8 +503,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
var User = this.sequelize.define('User', { username: DataTypes.STRING }) var User = this.sequelize.define('User', { username: DataTypes.STRING })
, Task = this.sequelize.define('Task', { title: DataTypes.STRING }); , Task = this.sequelize.define('Task', { title: DataTypes.STRING });
User.belongsToMany(Task); User.belongsToMany(Task, { through: 'UserTasks' });
Task.belongsToMany(User); Task.belongsToMany(User, { through: 'UserTasks' });
return this.sequelize.sync({ force: true }).then(function() { return this.sequelize.sync({ force: true }).then(function() {
return Promise.all([ return Promise.all([
...@@ -532,8 +532,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -532,8 +532,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
var User = this.sequelize.define('User', { username: DataTypes.STRING }) var User = this.sequelize.define('User', { username: DataTypes.STRING })
, Task = this.sequelize.define('Task', { title: DataTypes.STRING }); , Task = this.sequelize.define('Task', { title: DataTypes.STRING });
User.belongsToMany(Task); User.belongsToMany(Task, { through: 'UserTasks' });
Task.belongsToMany(User); Task.belongsToMany(User, { through: 'UserTasks' });
return this.sequelize.sync({ force: true }).then(function() { return this.sequelize.sync({ force: true }).then(function() {
return Task.create({ title: 'task' }); return Task.create({ title: 'task' });
...@@ -555,8 +555,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -555,8 +555,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
this.User = sequelize.define('User', { username: DataTypes.STRING }); this.User = sequelize.define('User', { username: DataTypes.STRING });
this.Task = sequelize.define('Task', { title: DataTypes.STRING }); this.Task = sequelize.define('Task', { title: DataTypes.STRING });
this.User.belongsToMany(this.Task); this.User.belongsToMany(this.Task, { through: 'UserTasks' });
this.Task.belongsToMany(this.User); this.Task.belongsToMany(this.User, { through: 'UserTasks' });
this.sequelize = sequelize; this.sequelize = sequelize;
return sequelize.sync({ force: true }); return sequelize.sync({ force: true });
...@@ -617,8 +617,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -617,8 +617,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
var User = this.sequelize.define('User', { username: DataTypes.STRING }) var User = this.sequelize.define('User', { username: DataTypes.STRING })
, Task = this.sequelize.define('Task', { title: DataTypes.STRING }); , Task = this.sequelize.define('Task', { title: DataTypes.STRING });
User.belongsToMany(Task); User.belongsToMany(Task, { through: 'UserTasks' });
Task.belongsToMany(User); Task.belongsToMany(User, { through: 'UserTasks' });
return this.sequelize.sync({ force: true }).then(function() { return this.sequelize.sync({ force: true }).then(function() {
return Task.create({ title: 'task' }); return Task.create({ title: 'task' });
...@@ -640,8 +640,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -640,8 +640,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
var User = this.sequelize.define('User', { username: DataTypes.STRING }) var User = this.sequelize.define('User', { username: DataTypes.STRING })
, Task = this.sequelize.define('Task', { title: DataTypes.STRING }); , Task = this.sequelize.define('Task', { title: DataTypes.STRING });
User.belongsToMany(Task); User.belongsToMany(Task, { through: 'UserTasks' });
Task.belongsToMany(User); Task.belongsToMany(User, { through: 'UserTasks' });
return this.sequelize.sync({ force: true }).then(function() { return this.sequelize.sync({ force: true }).then(function() {
return Promise.all([ return Promise.all([
...@@ -669,8 +669,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -669,8 +669,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
this.User = sequelize.define('User', { username: DataTypes.STRING }); this.User = sequelize.define('User', { username: DataTypes.STRING });
this.Task = sequelize.define('Task', { title: DataTypes.STRING }); this.Task = sequelize.define('Task', { title: DataTypes.STRING });
this.User.belongsToMany(this.Task); this.User.belongsToMany(this.Task, { through: 'UserTasks' });
this.Task.belongsToMany(this.User); this.Task.belongsToMany(this.User, { through: 'UserTasks' });
this.sequelize = sequelize; this.sequelize = sequelize;
return sequelize.sync({ force: true }); return sequelize.sync({ force: true });
...@@ -740,8 +740,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -740,8 +740,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
var User = this.sequelize.define('User', { username: DataTypes.STRING }) var User = this.sequelize.define('User', { username: DataTypes.STRING })
, Task = this.sequelize.define('Task', { title: DataTypes.STRING }); , Task = this.sequelize.define('Task', { title: DataTypes.STRING });
User.belongsToMany(Task); User.belongsToMany(Task, { through: 'UserTasks' });
Task.belongsToMany(User); Task.belongsToMany(User, { through: 'UserTasks' });
return this.sequelize.sync({ force: true }).then(function() { return this.sequelize.sync({ force: true }).then(function() {
return Promise.all([ return Promise.all([
...@@ -785,8 +785,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -785,8 +785,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
] ]
}); });
//create associations //create associations
User.belongsToMany(Task); User.belongsToMany(Task, { through: 'UserTasks' });
Task.belongsToMany(User); Task.belongsToMany(User, { through: 'UserTasks' });
return this.sequelize.sync({ force: true }); return this.sequelize.sync({ force: true });
}); });
}); });
...@@ -796,8 +796,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -796,8 +796,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
var User = this.sequelize.define('User', { username: DataTypes.STRING }) var User = this.sequelize.define('User', { username: DataTypes.STRING })
, Task = this.sequelize.define('Task', { title: DataTypes.STRING }); , Task = this.sequelize.define('Task', { title: DataTypes.STRING });
User.belongsToMany(Task); User.belongsToMany(Task, { through: 'UserTasks' });
Task.belongsToMany(User); Task.belongsToMany(User, { through: 'UserTasks' });
return this.sequelize.sync({ force: true }).then(function() { return this.sequelize.sync({ force: true }).then(function() {
return Promise.all([ return Promise.all([
...@@ -823,8 +823,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -823,8 +823,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
var User = this.sequelize.define('User', { username: DataTypes.STRING }) var User = this.sequelize.define('User', { username: DataTypes.STRING })
, Task = this.sequelize.define('Task', { title: DataTypes.STRING }); , Task = this.sequelize.define('Task', { title: DataTypes.STRING });
User.belongsToMany(Task); User.belongsToMany(Task, { through: 'UserTasks' });
Task.belongsToMany(User); Task.belongsToMany(User, { through: 'UserTasks' });
return this.sequelize.sync({ force: true }).then(function() { return this.sequelize.sync({ force: true }).then(function() {
return User.bulkCreate([ return User.bulkCreate([
...@@ -856,8 +856,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -856,8 +856,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
this.User = this.sequelize.define('User', { username: DataTypes.STRING }, {timestamps: false}); this.User = this.sequelize.define('User', { username: DataTypes.STRING }, {timestamps: false});
this.Task = this.sequelize.define('Task', { title: DataTypes.STRING }, {timestamps: false}); this.Task = this.sequelize.define('Task', { title: DataTypes.STRING }, {timestamps: false});
this.User.belongsToMany(this.Task); this.User.belongsToMany(this.Task, { through: 'UserTasks' });
this.Task.belongsToMany(this.User); this.Task.belongsToMany(this.User, { through: 'UserTasks' });
return this.sequelize.sync({force: true}); return this.sequelize.sync({force: true});
}); });
...@@ -933,8 +933,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -933,8 +933,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
} }
}); });
Beacons.belongsToMany(Users); Beacons.belongsToMany(Users, { through: 'UserBeacons' });
Users.belongsToMany(Beacons); Users.belongsToMany(Beacons, { through: 'UserBeacons' });
return this.sequelize.sync({force: true}); return this.sequelize.sync({force: true});
}); });
...@@ -964,8 +964,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -964,8 +964,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
, ParanoidUser = paranoidSequelize.define('ParanoidUser', {}) , ParanoidUser = paranoidSequelize.define('ParanoidUser', {})
, ParanoidTask = paranoidSequelize.define('ParanoidTask', {}); , ParanoidTask = paranoidSequelize.define('ParanoidTask', {});
ParanoidUser.belongsToMany(ParanoidTask); ParanoidUser.belongsToMany(ParanoidTask, { through: 'UserTasks' });
ParanoidTask.belongsToMany(ParanoidUser); ParanoidTask.belongsToMany(ParanoidUser, { through: 'UserTasks' });
expect(ParanoidUser.options.paranoid).to.be.ok; expect(ParanoidUser.options.paranoid).to.be.ok;
expect(ParanoidTask.options.paranoid).to.be.ok; expect(ParanoidTask.options.paranoid).to.be.ok;
...@@ -1558,8 +1558,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -1558,8 +1558,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
describe('source belongs to target', function() { describe('source belongs to target', function() {
beforeEach(function() { beforeEach(function() {
this.A.belongsTo(this.B, { as: 'relation1' }); this.A.belongsTo(this.B, { as: 'relation1' });
this.A.belongsToMany(this.B, { as: 'relation2' }); this.A.belongsToMany(this.B, { as: 'relation2', through: 'AB' });
this.B.belongsToMany(this.A, { as: 'relation2' }); this.B.belongsToMany(this.A, { as: 'relation2', through: 'AB' });
return this.sequelize.sync({ force: true }); return this.sequelize.sync({ force: true });
}); });
...@@ -1584,8 +1584,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -1584,8 +1584,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
describe('target belongs to source', function() { describe('target belongs to source', function() {
beforeEach(function() { beforeEach(function() {
this.B.belongsTo(this.A, { as: 'relation1' }); this.B.belongsTo(this.A, { as: 'relation1' });
this.A.belongsToMany(this.B, { as: 'relation2' }); this.A.belongsToMany(this.B, { as: 'relation2', through: 'AB' });
this.B.belongsToMany(this.A, { as: 'relation2' }); this.B.belongsToMany(this.A, { as: 'relation2', through: 'AB' });
return this.sequelize.sync({ force: true }); return this.sequelize.sync({ force: true });
}); });
...@@ -1717,8 +1717,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -1717,8 +1717,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
it('can cascade deletes both ways by default', function() { it('can cascade deletes both ways by default', function() {
var self = this; var self = this;
this.User.belongsToMany(this.Task); this.User.belongsToMany(this.Task, { through: 'tasksusers' });
this.Task.belongsToMany(this.User); this.Task.belongsToMany(this.User, { through: 'tasksusers' });
return this.sequelize.sync({ force: true }).bind({}).then(function() { return this.sequelize.sync({ force: true }).bind({}).then(function() {
return Promise.all([ return Promise.all([
...@@ -1758,8 +1758,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -1758,8 +1758,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
var self = this var self = this
, spy = sinon.spy(); , spy = sinon.spy();
this.User.belongsToMany(this.Task, { onDelete: 'RESTRICT'}); this.User.belongsToMany(this.Task, { onDelete: 'RESTRICT', through: 'tasksusers' });
this.Task.belongsToMany(this.User, { onDelete: 'RESTRICT'}); this.Task.belongsToMany(this.User, { onDelete: 'RESTRICT', through: 'tasksusers' });
return this.sequelize.sync({ force: true }).bind({}).then(function() { return this.sequelize.sync({ force: true }).bind({}).then(function() {
return Promise.all([ return Promise.all([
...@@ -1791,8 +1791,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -1791,8 +1791,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
var spy = sinon.spy() var spy = sinon.spy()
, self = this; , self = this;
self.User.belongsToMany(self.Task, { onDelete: 'RESTRICT'}); self.User.belongsToMany(self.Task, { onDelete: 'RESTRICT', through: 'tasksusers' });
self.Task.belongsToMany(self.User, { onDelete: 'CASCADE'}); self.Task.belongsToMany(self.User, { onDelete: 'CASCADE', through: 'tasksusers' });
return this.sequelize.sync({ force: true }).bind({}).then(function() { return this.sequelize.sync({ force: true }).bind({}).then(function() {
return Sequelize.Promise.join( return Sequelize.Promise.join(
...@@ -1829,8 +1829,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -1829,8 +1829,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
it('should be possible to remove all constraints', function() { it('should be possible to remove all constraints', function() {
var self = this; var self = this;
this.User.belongsToMany(this.Task, { constraints: false }); this.User.belongsToMany(this.Task, { constraints: false, through: 'tasksusers' });
this.Task.belongsToMany(this.User, { constraints: false }); this.Task.belongsToMany(this.User, { constraints: false, through: 'tasksusers' });
return this.sequelize.sync({ force: true }).bind({}).then(function() { return this.sequelize.sync({ force: true }).bind({}).then(function() {
return Promise.all([ return Promise.all([
......
...@@ -55,8 +55,8 @@ if (dialect.match(/^postgres/)) { ...@@ -55,8 +55,8 @@ if (dialect.match(/^postgres/)) {
this.users = null; this.users = null;
this.tasks = null; this.tasks = null;
this.User.hasMany(this.Task, {as: 'Tasks', through: 'usertasks'}); this.User.belongsToMany(this.Task, {as: 'Tasks', through: 'usertasks'});
this.Task.hasMany(this.User, {as: 'Users', through: 'usertasks'}); this.Task.belongsToMany(this.User, {as: 'Users', through: 'usertasks'});
var users = [] var users = []
, tasks = []; , tasks = [];
......
...@@ -1707,7 +1707,7 @@ describe(Support.getTestDialectTeaser('Instance'), function() { ...@@ -1707,7 +1707,7 @@ describe(Support.getTestDialectTeaser('Instance'), function() {
return User.sync().then(function() { return User.sync().then(function() {
var user = User.build({ username: 'foo' }); var user = User.build({ username: 'foo' });
expect(user.values).to.deep.equal({ username: 'foo', id: null }); expect(user.get({ plain: true })).to.deep.equal({ username: 'foo', id: null });
}); });
}); });
}); });
......
...@@ -397,7 +397,7 @@ describe(Support.getTestDialectTeaser('Sequelize'), function() { ...@@ -397,7 +397,7 @@ describe(Support.getTestDialectTeaser('Sequelize'), function() {
if (Support.getTestDialect() === 'postgres') { if (Support.getTestDialect() === 'postgres') {
it('replaces named parameters with the passed object and ignores casts', function() { it('replaces named parameters with the passed object and ignores casts', function() {
return expect(this.sequelize.query('select :one as foo, :two as bar, \'1000\'::integer as baz', null, { raw: true }, { one: 1, two: 2 }).get(0)) return expect(this.sequelize.query('select :one as foo, :two as bar, \'1000\'::integer as baz', null, { raw: true, replacements: { one: 1, two: 2 } }).get(0))
.to.eventually.deep.equal([{ foo: 1, bar: 2, baz: 1000 }]); .to.eventually.deep.equal([{ foo: 1, bar: 2, baz: 1000 }]);
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!