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

Commit 94f5e189 by Jan Aagaard Meier

Add chai missing assertions to dev deps and change some assertions not.to.be.def…

…ined -> to.be.undefined
1 parent fb94baeb
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
"chai": "^2.1.2", "chai": "^2.1.2",
"chai-as-promised": "^4.3.0", "chai-as-promised": "^4.3.0",
"chai-datetime": "~1.3.0", "chai-datetime": "~1.3.0",
"chai-missing-assertions": "^1.0.0",
"chai-spies": "~0.5.1", "chai-spies": "~0.5.1",
"coffee-script": "~1.7.1", "coffee-script": "~1.7.1",
"commander": "^2.6.0", "commander": "^2.6.0",
......
...@@ -216,7 +216,7 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -216,7 +216,7 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
}).then(function(projects) { }).then(function(projects) {
expect(projects).to.have.length(1); expect(projects).to.have.length(1);
var project = projects[0]; var project = projects[0];
expect(project.ProjectUsers).to.be.defined; expect(project.ProjectUsers).to.be.ok;
expect(project.status).not.to.exist; expect(project.status).not.to.exist;
expect(project.ProjectUsers.status).to.equal('active'); expect(project.ProjectUsers.status).to.equal('active');
}); });
...@@ -1086,7 +1086,7 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -1086,7 +1086,7 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
); );
}).spread(function(user, projects) { }).spread(function(user, projects) {
var project = projects[0]; var project = projects[0];
expect(project).to.be.defined; expect(project).to.be.ok;
return project.destroy().return (user); return project.destroy().return (user);
}).then(function(user) { }).then(function(user) {
return self.User.find({ return self.User.find({
...@@ -1097,7 +1097,7 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -1097,7 +1097,7 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
var projects = user.Projects var projects = user.Projects
, project = projects[0]; , project = projects[0];
expect(project).to.be.defined; expect(project).to.be.ok;
}); });
}); });
...@@ -1117,7 +1117,7 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -1117,7 +1117,7 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
}).then(function(projects) { }).then(function(projects) {
var project = projects[0]; var project = projects[0];
expect(project).to.be.defined; expect(project).to.be.ok;
return self.user.removeProject(project).on('sql', function(sql) { return self.user.removeProject(project).on('sql', function(sql) {
}).return (project); }).return (project);
}).then(function(project) { }).then(function(project) {
...@@ -1180,13 +1180,13 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -1180,13 +1180,13 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
}); });
}).then(function(groups) { }).then(function(groups) {
var group = groups[0]; var group = groups[0];
expect(group).to.be.defined; expect(group).to.be.ok;
var user = group.Users[0]; var user = group.Users[0];
expect(user).to.be.defined; expect(user).to.be.ok;
var project = user.Projects[0]; var project = user.Projects[0];
expect(project).to.be.defined; expect(project).to.be.ok;
expect(project.name).to.equal('Good Will Hunting'); expect(project.name).to.equal('Good Will Hunting');
}); });
}); });
...@@ -1307,7 +1307,7 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -1307,7 +1307,7 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
}).then(function(projects) { }).then(function(projects) {
var project = projects[0]; var project = projects[0];
expect(project.UserProjects).to.be.defined; expect(project.UserProjects).to.be.ok;
expect(project.status).not.to.exist; expect(project.status).not.to.exist;
expect(project.UserProjects.status).to.equal('active'); expect(project.UserProjects.status).to.equal('active');
expect(project.UserProjects.data).to.equal(42); expect(project.UserProjects.data).to.equal(42);
...@@ -1325,7 +1325,7 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -1325,7 +1325,7 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
}).then(function(projects) { }).then(function(projects) {
var project = projects[0]; var project = projects[0];
expect(project.UserProjects).to.be.defined; expect(project.UserProjects).to.be.ok;
expect(project.status).not.to.exist; expect(project.status).not.to.exist;
expect(project.UserProjects.status).to.equal('active'); expect(project.UserProjects.status).to.equal('active');
expect(project.UserProjects.data).not.to.exist; expect(project.UserProjects.data).not.to.exist;
...@@ -1877,7 +1877,7 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() { ...@@ -1877,7 +1877,7 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
var UserProjects = User.belongsToMany(Project, { foreignKey: { name: 'user_id', defaultValue: 42 }}); var UserProjects = User.belongsToMany(Project, { foreignKey: { name: 'user_id', defaultValue: 42 }});
expect(UserProjects.through.model.rawAttributes.user_id).to.be.defined; expect(UserProjects.through.model.rawAttributes.user_id).to.be.ok;
expect(UserProjects.through.model.rawAttributes.user_id.references).to.equal(User.getTableName()); expect(UserProjects.through.model.rawAttributes.user_id.references).to.equal(User.getTableName());
expect(UserProjects.through.model.rawAttributes.user_id.referencesKey).to.equal('uid'); expect(UserProjects.through.model.rawAttributes.user_id.referencesKey).to.equal('uid');
expect(UserProjects.through.model.rawAttributes.user_id.defaultValue).to.equal(42); expect(UserProjects.through.model.rawAttributes.user_id.defaultValue).to.equal(42);
......
...@@ -639,7 +639,7 @@ describe(Support.getTestDialectTeaser('BelongsTo'), function() { ...@@ -639,7 +639,7 @@ describe(Support.getTestDialectTeaser('BelongsTo'), function() {
} }
}); });
expect(Task.rawAttributes.uid).to.be.defined; expect(Task.rawAttributes.uid).to.be.ok;
expect(Task.rawAttributes.uid.allowNull).to.be.false; expect(Task.rawAttributes.uid.allowNull).to.be.false;
expect(Task.rawAttributes.uid.references).to.equal(User.getTableName()); expect(Task.rawAttributes.uid.references).to.equal(User.getTableName());
expect(Task.rawAttributes.uid.referencesKey).to.equal('id'); expect(Task.rawAttributes.uid.referencesKey).to.equal('id');
...@@ -661,7 +661,7 @@ describe(Support.getTestDialectTeaser('BelongsTo'), function() { ...@@ -661,7 +661,7 @@ describe(Support.getTestDialectTeaser('BelongsTo'), function() {
Profile.belongsTo(User, { foreignKey: Profile.rawAttributes.user_id}); Profile.belongsTo(User, { foreignKey: Profile.rawAttributes.user_id});
expect(Profile.rawAttributes.user_id).to.be.defined; expect(Profile.rawAttributes.user_id).to.be.ok;
expect(Profile.rawAttributes.user_id.references).to.equal(User.getTableName()); expect(Profile.rawAttributes.user_id.references).to.equal(User.getTableName());
expect(Profile.rawAttributes.user_id.referencesKey).to.equal('uid'); expect(Profile.rawAttributes.user_id.referencesKey).to.equal('uid');
expect(Profile.rawAttributes.user_id.allowNull).to.be.false; expect(Profile.rawAttributes.user_id.allowNull).to.be.false;
...@@ -678,7 +678,7 @@ describe(Support.getTestDialectTeaser('BelongsTo'), function() { ...@@ -678,7 +678,7 @@ describe(Support.getTestDialectTeaser('BelongsTo'), function() {
Task.belongsTo(Project, { foreignKey: { allowNull: true }}); Task.belongsTo(Project, { foreignKey: { allowNull: true }});
expect(Task.rawAttributes.projectId).to.be.defined; expect(Task.rawAttributes.projectId).to.be.ok;
expect(Task.rawAttributes.projectId.defaultValue).to.equal(42); expect(Task.rawAttributes.projectId.defaultValue).to.equal(42);
expect(Task.rawAttributes.projectId.allowNull).to.be.ok; expect(Task.rawAttributes.projectId.allowNull).to.be.ok;
}); });
......
...@@ -945,7 +945,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() { ...@@ -945,7 +945,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() {
}).then(function(projects) { }).then(function(projects) {
expect(projects).to.have.length(1); expect(projects).to.have.length(1);
var project = projects[0]; var project = projects[0];
expect(project.ProjectUsers).to.be.defined; expect(project.ProjectUsers).to.be.ok;
expect(project.status).not.to.exist; expect(project.status).not.to.exist;
expect(project.ProjectUsers.status).to.equal('active'); expect(project.ProjectUsers.status).to.equal('active');
}); });
...@@ -1613,7 +1613,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() { ...@@ -1613,7 +1613,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() {
); );
}).spread(function(user, projects) { }).spread(function(user, projects) {
var project = projects[0]; var project = projects[0];
expect(project).to.be.defined; expect(project).to.be.ok;
return project.destroy().return (user); return project.destroy().return (user);
}).then(function(user) { }).then(function(user) {
return self.User.find({ return self.User.find({
...@@ -1624,7 +1624,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() { ...@@ -1624,7 +1624,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() {
var projects = user.Projects var projects = user.Projects
, project = projects[0]; , project = projects[0];
expect(project).to.be.defined; expect(project).to.be.ok;
}); });
}); });
...@@ -1644,7 +1644,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() { ...@@ -1644,7 +1644,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() {
}).then(function(projects) { }).then(function(projects) {
var project = projects[0]; var project = projects[0];
expect(project).to.be.defined; expect(project).to.be.ok;
return self.user.removeProject(project).return(project); return self.user.removeProject(project).return(project);
}).then(function(project) { }).then(function(project) {
return self.user.setProjects([project]); return self.user.setProjects([project]);
...@@ -1664,7 +1664,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() { ...@@ -1664,7 +1664,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() {
return user.getPuppies().then(function(puppies) { return user.getPuppies().then(function(puppies) {
var puppy = puppies[0]; var puppy = puppies[0];
expect(puppy).to.be.defined; expect(puppy).to.be.ok;
expect(puppy.rawAttributes.userId).to.be.ok; expect(puppy.rawAttributes.userId).to.be.ok;
expect(puppy.userId).to.equal(user.id); expect(puppy.userId).to.equal(user.id);
}); });
...@@ -1718,13 +1718,13 @@ describe(Support.getTestDialectTeaser('HasMany'), function() { ...@@ -1718,13 +1718,13 @@ describe(Support.getTestDialectTeaser('HasMany'), function() {
}); });
}).then(function(groups) { }).then(function(groups) {
var group = groups[0]; var group = groups[0];
expect(group).to.be.defined; expect(group).to.be.ok;
var user = group.Users[0]; var user = group.Users[0];
expect(user).to.be.defined; expect(user).to.be.ok;
var project = user.Projects[0]; var project = user.Projects[0];
expect(project).to.be.defined; expect(project).to.be.ok;
expect(project.name).to.equal('Good Will Hunting'); expect(project.name).to.equal('Good Will Hunting');
}); });
}); });
...@@ -1845,7 +1845,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() { ...@@ -1845,7 +1845,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() {
}).then(function(projects) { }).then(function(projects) {
var project = projects[0]; var project = projects[0];
expect(project.UserProjects).to.be.defined; expect(project.UserProjects).to.be.ok;
expect(project.status).not.to.exist; expect(project.status).not.to.exist;
expect(project.UserProjects.status).to.equal('active'); expect(project.UserProjects.status).to.equal('active');
expect(project.UserProjects.data).to.equal(42); expect(project.UserProjects.data).to.equal(42);
...@@ -1863,7 +1863,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() { ...@@ -1863,7 +1863,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() {
}).then(function(projects) { }).then(function(projects) {
var project = projects[0]; var project = projects[0];
expect(project.UserProjects).to.be.defined; expect(project.UserProjects).to.be.ok;
expect(project.status).not.to.exist; expect(project.status).not.to.exist;
expect(project.UserProjects.status).to.equal('active'); expect(project.UserProjects.status).to.equal('active');
expect(project.UserProjects.data).not.to.exist; expect(project.UserProjects.data).not.to.exist;
...@@ -2621,7 +2621,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() { ...@@ -2621,7 +2621,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() {
} }
}); });
expect(Task.rawAttributes.uid).to.be.defined; expect(Task.rawAttributes.uid).to.be.ok;
expect(Task.rawAttributes.uid.allowNull).to.be.false; expect(Task.rawAttributes.uid.allowNull).to.be.false;
expect(Task.rawAttributes.uid.references).to.equal(User.getTableName()); expect(Task.rawAttributes.uid.references).to.equal(User.getTableName());
expect(Task.rawAttributes.uid.referencesKey).to.equal('id'); expect(Task.rawAttributes.uid.referencesKey).to.equal('id');
...@@ -2632,14 +2632,14 @@ describe(Support.getTestDialectTeaser('HasMany'), function() { ...@@ -2632,14 +2632,14 @@ describe(Support.getTestDialectTeaser('HasMany'), function() {
} }
}); });
expect(Task.rawAttributes.uid).not.to.be.defined; expect(Task.rawAttributes.uid).to.be.undefined;
expect(Task.associations.tasksusers.through.model.rawAttributes.taskId).to.be.defined; expect(Task.associations.tasksusers.through.model.rawAttributes.taskId).to.be.ok;
expect(Task.associations.tasksusers.through.model.rawAttributes.taskId.allowNull).to.be.false; expect(Task.associations.tasksusers.through.model.rawAttributes.taskId.allowNull).to.be.false;
expect(Task.associations.tasksusers.through.model.rawAttributes.taskId.references).to.equal(Task.getTableName()); expect(Task.associations.tasksusers.through.model.rawAttributes.taskId.references).to.equal(Task.getTableName());
expect(Task.associations.tasksusers.through.model.rawAttributes.taskId.referencesKey).to.equal('id'); expect(Task.associations.tasksusers.through.model.rawAttributes.taskId.referencesKey).to.equal('id');
expect(Task.associations.tasksusers.through.model.rawAttributes.uid).to.be.defined; expect(Task.associations.tasksusers.through.model.rawAttributes.uid).to.be.ok;
expect(Task.associations.tasksusers.through.model.rawAttributes.uid.allowNull).to.be.false; expect(Task.associations.tasksusers.through.model.rawAttributes.uid.allowNull).to.be.false;
expect(Task.associations.tasksusers.through.model.rawAttributes.uid.references).to.equal(User.getTableName()); expect(Task.associations.tasksusers.through.model.rawAttributes.uid.references).to.equal(User.getTableName());
expect(Task.associations.tasksusers.through.model.rawAttributes.uid.referencesKey).to.equal('id'); expect(Task.associations.tasksusers.through.model.rawAttributes.uid.referencesKey).to.equal('id');
...@@ -2661,7 +2661,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() { ...@@ -2661,7 +2661,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() {
User.hasMany(Project, { foreignKey: Project.rawAttributes.user_id}); User.hasMany(Project, { foreignKey: Project.rawAttributes.user_id});
expect(Project.rawAttributes.user_id).to.be.defined; expect(Project.rawAttributes.user_id).to.be.ok;
expect(Project.rawAttributes.user_id.references).to.equal(User.getTableName()); expect(Project.rawAttributes.user_id.references).to.equal(User.getTableName());
expect(Project.rawAttributes.user_id.referencesKey).to.equal('uid'); expect(Project.rawAttributes.user_id.referencesKey).to.equal('uid');
expect(Project.rawAttributes.user_id.defaultValue).to.equal(42); expect(Project.rawAttributes.user_id.defaultValue).to.equal(42);
...@@ -2678,7 +2678,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() { ...@@ -2678,7 +2678,7 @@ describe(Support.getTestDialectTeaser('HasMany'), function() {
User.hasMany(Task, { foreignKey: { allowNull: true }}); User.hasMany(Task, { foreignKey: { allowNull: true }});
expect(Task.rawAttributes.userId).to.be.defined; expect(Task.rawAttributes.userId).to.be.ok;
expect(Task.rawAttributes.userId.defaultValue).to.equal(42); expect(Task.rawAttributes.userId.defaultValue).to.equal(42);
expect(Task.rawAttributes.userId.allowNull).to.be.ok; expect(Task.rawAttributes.userId.allowNull).to.be.ok;
}); });
......
...@@ -534,7 +534,7 @@ describe(Support.getTestDialectTeaser('HasOne'), function() { ...@@ -534,7 +534,7 @@ describe(Support.getTestDialectTeaser('HasOne'), function() {
} }
}); });
expect(Profile.rawAttributes.uid).to.be.defined; expect(Profile.rawAttributes.uid).to.be.ok;
expect(Profile.rawAttributes.uid.references).to.equal(User.getTableName()); expect(Profile.rawAttributes.uid.references).to.equal(User.getTableName());
expect(Profile.rawAttributes.uid.referencesKey).to.equal('id'); expect(Profile.rawAttributes.uid.referencesKey).to.equal('id');
expect(Profile.rawAttributes.uid.allowNull).to.be.false; expect(Profile.rawAttributes.uid.allowNull).to.be.false;
...@@ -548,7 +548,7 @@ describe(Support.getTestDialectTeaser('HasOne'), function() { ...@@ -548,7 +548,7 @@ describe(Support.getTestDialectTeaser('HasOne'), function() {
} }
}); });
expect(Profile.rawAttributes.uid).to.be.defined; expect(Profile.rawAttributes.uid).to.be.ok;
expect(Profile.rawAttributes.uid.references).to.equal(User.getTableName()); expect(Profile.rawAttributes.uid.references).to.equal(User.getTableName());
expect(Profile.rawAttributes.uid.referencesKey).to.equal('id'); expect(Profile.rawAttributes.uid.referencesKey).to.equal('id');
expect(Profile.rawAttributes.uid.allowNull).to.be.false; expect(Profile.rawAttributes.uid.allowNull).to.be.false;
...@@ -570,7 +570,7 @@ describe(Support.getTestDialectTeaser('HasOne'), function() { ...@@ -570,7 +570,7 @@ describe(Support.getTestDialectTeaser('HasOne'), function() {
User.hasOne(Profile, { foreignKey: Profile.rawAttributes.user_id}); User.hasOne(Profile, { foreignKey: Profile.rawAttributes.user_id});
expect(Profile.rawAttributes.user_id).to.be.defined; expect(Profile.rawAttributes.user_id).to.be.ok;
expect(Profile.rawAttributes.user_id.references).to.equal(User.getTableName()); expect(Profile.rawAttributes.user_id.references).to.equal(User.getTableName());
expect(Profile.rawAttributes.user_id.referencesKey).to.equal('uid'); expect(Profile.rawAttributes.user_id.referencesKey).to.equal('uid');
expect(Profile.rawAttributes.user_id.allowNull).to.be.false; expect(Profile.rawAttributes.user_id.allowNull).to.be.false;
...@@ -592,7 +592,7 @@ describe(Support.getTestDialectTeaser('HasOne'), function() { ...@@ -592,7 +592,7 @@ describe(Support.getTestDialectTeaser('HasOne'), function() {
User.hasOne(Project, { foreignKey: { allowNull: false }}); User.hasOne(Project, { foreignKey: { allowNull: false }});
expect(Project.rawAttributes.userUid).to.be.defined; expect(Project.rawAttributes.userUid).to.be.ok;
expect(Project.rawAttributes.userUid.allowNull).to.be.false; expect(Project.rawAttributes.userUid.allowNull).to.be.false;
expect(Project.rawAttributes.userUid.references).to.equal(User.getTableName()); expect(Project.rawAttributes.userUid.references).to.equal(User.getTableName());
expect(Project.rawAttributes.userUid.referencesKey).to.equal('uid'); expect(Project.rawAttributes.userUid.referencesKey).to.equal('uid');
......
...@@ -547,7 +547,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), function() { ...@@ -547,7 +547,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), function() {
var successfulUser = User.build({ name: '2' }); var successfulUser = User.build({ name: '2' });
return successfulUser.validate().then(function(err) { return successfulUser.validate().then(function(err) {
expect(err).not.to.be.defined; expect(err).to.be.undefined;
}); });
}); });
}); });
...@@ -576,7 +576,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), function() { ...@@ -576,7 +576,7 @@ describe(Support.getTestDialectTeaser('InstanceValidator'), function() {
expect(error.get('name')[0].message).to.equal('Invalid username'); expect(error.get('name')[0].message).to.equal('Invalid username');
return User.build({ name: 'no error' }).validate().then(function(errors) { return User.build({ name: 'no error' }).validate().then(function(errors) {
expect(errors).not.to.be.defined; expect(errors).to.be.undefined;
}); });
}); });
}); });
......
...@@ -2365,7 +2365,7 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -2365,7 +2365,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
if (dialect !== 'sqlite' && current.dialect.supports.transactions) { if (dialect !== 'sqlite' && current.dialect.supports.transactions) {
it('supports multiple async transactions', function() { it('supports multiple async transactions', function() {
this.timeout(25000); this.timeout(50000);
var self = this; var self = this;
return Support.prepareTransactionTest(this.sequelize).bind({}).then(function(sequelize) { return Support.prepareTransactionTest(this.sequelize).bind({}).then(function(sequelize) {
var User = sequelize.define('User', { username: Sequelize.STRING }); var User = sequelize.define('User', { username: Sequelize.STRING });
......
...@@ -43,7 +43,7 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -43,7 +43,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
it('works with upsert on id', function() { it('works with upsert on id', function() {
return this.User.upsert({ id: 42, username: 'john' }).bind(this).then(function(created) { return this.User.upsert({ id: 42, username: 'john' }).bind(this).then(function(created) {
if (dialect === 'sqlite') { if (dialect === 'sqlite') {
expect(created).not.to.be.defined; expect(created).to.be.undefined;
} else { } else {
expect(created).to.be.ok; expect(created).to.be.ok;
} }
...@@ -53,14 +53,14 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -53,14 +53,14 @@ describe(Support.getTestDialectTeaser('Model'), function() {
}); });
}).then(function(created) { }).then(function(created) {
if (dialect === 'sqlite') { if (dialect === 'sqlite') {
expect(created).not.to.be.defined; expect(created).to.be.undefined;
} else { } else {
expect(created).not.to.be.ok; expect(created).not.to.be.ok;
} }
return this.User.find(42); return this.User.find(42);
}).then(function(user) { }).then(function(user) {
expect(user.createdAt).to.be.defined; expect(user.createdAt).to.be.ok;
expect(user.username).to.equal('doe'); expect(user.username).to.equal('doe');
expect(user.updatedAt).to.be.afterTime(user.createdAt); expect(user.updatedAt).to.be.afterTime(user.createdAt);
}); });
...@@ -69,7 +69,7 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -69,7 +69,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
it('works with upsert on a composite key', function() { it('works with upsert on a composite key', function() {
return this.User.upsert({ foo: 'baz', bar: 19, username: 'john' }).bind(this).then(function(created) { return this.User.upsert({ foo: 'baz', bar: 19, username: 'john' }).bind(this).then(function(created) {
if (dialect === 'sqlite') { if (dialect === 'sqlite') {
expect(created).not.to.be.defined; expect(created).to.be.undefined;
} else { } else {
expect(created).to.be.ok; expect(created).to.be.ok;
} }
...@@ -79,14 +79,14 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -79,14 +79,14 @@ describe(Support.getTestDialectTeaser('Model'), function() {
}); });
}).then(function(created) { }).then(function(created) {
if (dialect === 'sqlite') { if (dialect === 'sqlite') {
expect(created).not.to.be.defined; expect(created).to.be.undefined;
} else { } else {
expect(created).not.to.be.ok; expect(created).not.to.be.ok;
} }
return this.User.find({ where: { foo: 'baz', bar: 19 }}); return this.User.find({ where: { foo: 'baz', bar: 19 }});
}).then(function(user) { }).then(function(user) {
expect(user.createdAt).to.be.defined; expect(user.createdAt).to.be.ok;
expect(user.username).to.equal('doe'); expect(user.username).to.equal('doe');
expect(user.updatedAt).to.be.afterTime(user.createdAt); expect(user.updatedAt).to.be.afterTime(user.createdAt);
}); });
...@@ -113,8 +113,8 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -113,8 +113,8 @@ describe(Support.getTestDialectTeaser('Model'), function() {
]); ]);
}).spread(function(created1, created2) { }).spread(function(created1, created2) {
if (dialect === 'sqlite') { if (dialect === 'sqlite') {
expect(created1).not.to.be.defined; expect(created1).to.be.undefined;
expect(created2).not.to.be.defined; expect(created2).to.be.undefined;
} else { } else {
expect(created1).to.be.ok; expect(created1).to.be.ok;
expect(created2).to.be.ok; expect(created2).to.be.ok;
...@@ -126,21 +126,21 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -126,21 +126,21 @@ describe(Support.getTestDialectTeaser('Model'), function() {
}); });
}).then(function(created) { }).then(function(created) {
if (dialect === 'sqlite') { if (dialect === 'sqlite') {
expect(created).not.to.be.defined; expect(created).to.be.undefined;
} else { } else {
expect(created).not.to.be.ok; expect(created).not.to.be.ok;
} }
return User.find({ where: { a: 'a', b: 'b' }}); return User.find({ where: { a: 'a', b: 'b' }});
}).then(function (user1) { }).then(function (user1) {
expect(user1.createdAt).to.be.defined; expect(user1.createdAt).to.be.ok;
expect(user1.username).to.equal('doe'); expect(user1.username).to.equal('doe');
expect(user1.updatedAt).to.be.afterTime(user1.createdAt); expect(user1.updatedAt).to.be.afterTime(user1.createdAt);
return User.find({ where: { a: 'a', b: 'a' }}); return User.find({ where: { a: 'a', b: 'a' }});
}).then(function (user2) { }).then(function (user2) {
// The second one should not be updated // The second one should not be updated
expect(user2.createdAt).to.be.defined; expect(user2.createdAt).to.be.ok;
expect(user2.username).to.equal('curt'); expect(user2.username).to.equal('curt');
expect(user2.updatedAt).to.equalTime(user2.createdAt); expect(user2.updatedAt).to.equalTime(user2.createdAt);
}); });
...@@ -162,7 +162,7 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -162,7 +162,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
it('works with BLOBs', function () { it('works with BLOBs', function () {
return this.User.upsert({ id: 42, username: 'john', blob: new Buffer('kaj') }).bind(this).then(function(created) { return this.User.upsert({ id: 42, username: 'john', blob: new Buffer('kaj') }).bind(this).then(function(created) {
if (dialect === 'sqlite') { if (dialect === 'sqlite') {
expect(created).not.to.be.defined; expect(created).to.be.undefined;
} else { } else {
expect(created).to.be.ok; expect(created).to.be.ok;
} }
...@@ -172,14 +172,14 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -172,14 +172,14 @@ describe(Support.getTestDialectTeaser('Model'), function() {
}); });
}).then(function(created) { }).then(function(created) {
if (dialect === 'sqlite') { if (dialect === 'sqlite') {
expect(created).not.to.be.defined; expect(created).to.be.undefined;
} else { } else {
expect(created).not.to.be.ok; expect(created).not.to.be.ok;
} }
return this.User.find(42); return this.User.find(42);
}).then(function(user) { }).then(function(user) {
expect(user.createdAt).to.be.defined; expect(user.createdAt).to.be.ok;
expect(user.username).to.equal('doe'); expect(user.username).to.equal('doe');
expect(user.blob.toString()).to.equal('andrea'); expect(user.blob.toString()).to.equal('andrea');
expect(user.updatedAt).to.be.afterTime(user.createdAt); expect(user.updatedAt).to.be.afterTime(user.createdAt);
...@@ -189,7 +189,7 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -189,7 +189,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
it('works with .field', function () { it('works with .field', function () {
return this.User.upsert({ id: 42, baz: 'foo' }).bind(this).then(function(created) { return this.User.upsert({ id: 42, baz: 'foo' }).bind(this).then(function(created) {
if (dialect === 'sqlite') { if (dialect === 'sqlite') {
expect(created).not.to.be.defined; expect(created).to.be.undefined;
} else { } else {
expect(created).to.be.ok; expect(created).to.be.ok;
} }
...@@ -199,7 +199,7 @@ describe(Support.getTestDialectTeaser('Model'), function() { ...@@ -199,7 +199,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
}); });
}).then(function(created) { }).then(function(created) {
if (dialect === 'sqlite') { if (dialect === 'sqlite') {
expect(created).not.to.be.defined; expect(created).to.be.undefined;
} else { } else {
expect(created).not.to.be.ok; expect(created).not.to.be.ok;
} }
......
...@@ -139,7 +139,7 @@ describe(Support.getTestDialectTeaser('Sequelize#transaction'), function() { ...@@ -139,7 +139,7 @@ describe(Support.getTestDialectTeaser('Sequelize#transaction'), function() {
return self.Model.create({ name: 'omnom' }, { transaction: t1 }).then(function(m1) { return self.Model.create({ name: 'omnom' }, { transaction: t1 }).then(function(m1) {
return Promise.all([ return Promise.all([
self.Model.create({ name: 'omnom' }, { transaction: t2 }).catch(function(err) { self.Model.create({ name: 'omnom' }, { transaction: t2 }).catch(function(err) {
expect(err).to.be.defined; expect(err).to.be.ok;
return t2.rollback(); return t2.rollback();
}), }),
Promise.delay(100).then(function() { Promise.delay(100).then(function() {
......
...@@ -8,9 +8,10 @@ var fs = require('fs') ...@@ -8,9 +8,10 @@ var fs = require('fs')
, Config = require(__dirname + '/config/config') , Config = require(__dirname + '/config/config')
, chai = require('chai') , chai = require('chai')
, expect = chai.expect , expect = chai.expect
, chaiAsPromised = require('chai-as-promised'); , chaiAsPromised = require('chai-as-promised')
, missingAssertions = require('chai-missing-assertions');
chai.use(chaiAsPromised); chai.use(missingAssertions);
// Make sure errors get thrown when testing // Make sure errors get thrown when testing
Sequelize.Promise.onPossiblyUnhandledRejection(function(e, promise) { Sequelize.Promise.onPossiblyUnhandledRejection(function(e, promise) {
...@@ -209,4 +210,4 @@ beforeEach(function() { ...@@ -209,4 +210,4 @@ beforeEach(function() {
}); });
Support.sequelize = Support.createSequelizeInstance(); Support.sequelize = Support.createSequelizeInstance();
module.exports = Support; module.exports = Support;
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!