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

Commit c355fb75 by José Moreira

Cleaning unneeded stuff

1 parent cb3444a4
...@@ -61,7 +61,7 @@ describe(Support.getTestDialectTeaser("BelongsTo"), function() { ...@@ -61,7 +61,7 @@ describe(Support.getTestDialectTeaser("BelongsTo"), function() {
User.sync({ force: true }).success(function() { User.sync({ force: true }).success(function() {
Task.sync({ force: true }).success(function() { Task.sync({ force: true }).success(function() {
User.create({ username: 'foo', gender: 'male' }).success(function(user) { User.create({ username: 'foo', gender: 'male' }).success(function(user) {
User.create({ username: 'bar', gender: 'female' }).success(function(falsePositiveCheck) { User.create({ username: 'bar', gender: 'female' }).success(function() {
Task.create({ title: 'task', status: 'inactive' }).success(function(task) { Task.create({ title: 'task', status: 'inactive' }).success(function(task) {
task.setUserXYZ(user).success(function() { task.setUserXYZ(user).success(function() {
task.getUserXYZ({where: ['gender = ?', 'female']}).success(function(user) { task.getUserXYZ({where: ['gender = ?', 'female']}).success(function(user) {
...@@ -195,14 +195,14 @@ describe(Support.getTestDialectTeaser("BelongsTo"), function() { ...@@ -195,14 +195,14 @@ describe(Support.getTestDialectTeaser("BelongsTo"), function() {
Post.hasOne(Comment); Post.hasOne(Comment);
Comment.belongsTo(Post); Comment.belongsTo(Post);
this.sequelize.sync().done(function (err) { this.sequelize.sync().done(function () {
Post.create({ Post.create({
title: 'Post title', title: 'Post title',
}).done(function(err, post) { }).done(function(err, post) {
Comment.create({ Comment.create({
text: 'OLD VALUE', text: 'OLD VALUE',
}).done(function(err, comment) { }).done(function(err, comment) {
comment.setPost(post).done(function(err) { comment.setPost(post).done(function() {
expect(comment.text).to.equal('UPDATED VALUE'); expect(comment.text).to.equal('UPDATED VALUE');
done() done()
}); });
......
...@@ -117,7 +117,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() { ...@@ -117,7 +117,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
describe('hasAll', function() { describe('hasAll', function() {
beforeEach(function(done) { beforeEach(function(done) {
var self = this
this.Article = this.sequelize.define('Article', { this.Article = this.sequelize.define('Article', {
'title': DataTypes.STRING 'title': DataTypes.STRING
}) })
...@@ -332,7 +331,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() { ...@@ -332,7 +331,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
Article.sync({ force: true }).success(function() { Article.sync({ force: true }).success(function() {
Label.sync({ force: true }).success(function() { Label.sync({ force: true }).success(function() {
Article.create({ title: 'foo' }).success(function(article) { Article.create({ title: 'foo' }).success(function(article) {
article.createLabel({ text: 'bar' }).success(function(label) { article.createLabel({ text: 'bar' }).success(function() {
Label Label
.findAll({ where: { ArticleId: article.id }}) .findAll({ where: { ArticleId: article.id }})
...@@ -377,7 +376,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() { ...@@ -377,7 +376,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
}) })
it('supports transactions', function(done) { it('supports transactions', function(done) {
var self = this
Support.prepareTransactionTest(this.sequelize, function(sequelize) { Support.prepareTransactionTest(this.sequelize, function(sequelize) {
var Article = sequelize.define('Article', { 'title': DataTypes.STRING }) var Article = sequelize.define('Article', { 'title': DataTypes.STRING })
, Label = sequelize.define('Label', { 'text': DataTypes.STRING }) , Label = sequelize.define('Label', { 'text': DataTypes.STRING })
...@@ -868,7 +866,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() { ...@@ -868,7 +866,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
}) })
it('supports transactions', function(done) { it('supports transactions', function(done) {
var self = this
Support.prepareTransactionTest(this.sequelize, function(sequelize) { Support.prepareTransactionTest(this.sequelize, function(sequelize) {
var User = sequelize.define('User', { username: DataTypes.STRING }) var User = sequelize.define('User', { username: DataTypes.STRING })
, Task = sequelize.define('Task', { title: DataTypes.STRING }) , Task = sequelize.define('Task', { title: DataTypes.STRING })
...@@ -928,7 +925,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() { ...@@ -928,7 +925,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
describe('optimizations using bulk create, destroy and update', function () { describe('optimizations using bulk create, destroy and update', function () {
beforeEach(function (done) { beforeEach(function (done) {
var self = this
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})
...@@ -1042,7 +1038,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() { ...@@ -1042,7 +1038,6 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
describe('primary key handling for join table', function () { describe('primary key handling for join table', function () {
beforeEach(function (done) { beforeEach(function (done) {
var self = this
this.User = this.sequelize.define('User', this.User = this.sequelize.define('User',
{ username: DataTypes.STRING }, { username: DataTypes.STRING },
{ tableName: 'users'} { tableName: 'users'}
...@@ -1313,7 +1308,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() { ...@@ -1313,7 +1308,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
expect(err).not.to.be.ok expect(err).not.to.be.ok
Task.findAll().done(function (err, tasks) { Task.findAll().done(function (err, tasks) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
worker.setTasks(tasks).done(function (err) { worker.setTasks(tasks).done(function () {
worker.setTasks(tasks).done(function (err) { worker.setTasks(tasks).done(function (err) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
done() done()
...@@ -1344,7 +1339,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() { ...@@ -1344,7 +1339,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
expect(err).not.to.be.ok expect(err).not.to.be.ok
Task.findAll().done(function (err, tasks) { Task.findAll().done(function (err, tasks) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
worker.setTasks(tasks).done(function (err) { worker.setTasks(tasks).done(function () {
worker.removeTask(tasks[0]).done(function (err) { worker.removeTask(tasks[0]).done(function (err) {
expect(err).not.to.be.ok expect(err).not.to.be.ok
...@@ -1462,8 +1457,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() { ...@@ -1462,8 +1457,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
}) })
it("correctly identifies its counterpart when through is a string", function (done) { it("correctly identifies its counterpart when through is a string", function (done) {
var self = this var User = this.sequelize.define('User', {})
, User = this.sequelize.define('User', {})
, Group = this.sequelize.define('Group', {}) , Group = this.sequelize.define('Group', {})
User.hasMany(Group, { as: 'MyGroups', through: 'group_user'}) User.hasMany(Group, { as: 'MyGroups', through: 'group_user'})
...@@ -1479,8 +1473,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() { ...@@ -1479,8 +1473,7 @@ describe(Support.getTestDialectTeaser("HasMany"), function() {
}) })
it("correctly identifies its counterpart when through is a model", function (done) { it("correctly identifies its counterpart when through is a model", function (done) {
var self = this var User = this.sequelize.define('User', {})
, User = this.sequelize.define('User', {})
, Group = this.sequelize.define('Group', {}) , Group = this.sequelize.define('Group', {})
, UserGroup = this.sequelize.define('GroupUser', {}, {tableName: 'user_groups'}) , UserGroup = this.sequelize.define('GroupUser', {}, {tableName: 'user_groups'})
......
...@@ -104,7 +104,6 @@ describe(Support.getTestDialectTeaser("HasOne"), function() { ...@@ -104,7 +104,6 @@ describe(Support.getTestDialectTeaser("HasOne"), function() {
it('can set an association with predefined primary keys', function(done) { it('can set an association with predefined primary keys', function(done) {
var User = this.sequelize.define('UserXYZZ', { userCoolIdTag: { type: Sequelize.INTEGER, primaryKey: true }, username: Sequelize.STRING }) var User = this.sequelize.define('UserXYZZ', { userCoolIdTag: { type: Sequelize.INTEGER, primaryKey: true }, username: Sequelize.STRING })
, Task = this.sequelize.define('TaskXYZZ', { taskOrSomething: { type: Sequelize.INTEGER, primaryKey: true }, title: Sequelize.STRING }) , Task = this.sequelize.define('TaskXYZZ', { taskOrSomething: { type: Sequelize.INTEGER, primaryKey: true }, title: Sequelize.STRING })
, self = this
User.hasOne(Task, {foreignKey: 'userCoolIdTag'}) User.hasOne(Task, {foreignKey: 'userCoolIdTag'})
...@@ -191,7 +190,7 @@ describe(Support.getTestDialectTeaser("HasOne"), function() { ...@@ -191,7 +190,7 @@ describe(Support.getTestDialectTeaser("HasOne"), function() {
sequelize.sync({ force: true }).success(function() { sequelize.sync({ force: true }).success(function() {
User.create({ username: 'bob' }).success(function(user) { User.create({ username: 'bob' }).success(function(user) {
sequelize.transaction(function(t) { sequelize.transaction(function(t) {
user.createGroup({ name: 'testgroup' }, { transaction: t }).success(function(group) { user.createGroup({ name: 'testgroup' }, { transaction: t }).success(function() {
User.all().success(function (users) { User.all().success(function (users) {
users[0].getGroup().success(function (group) { users[0].getGroup().success(function (group) {
expect(group).to.be.null; expect(group).to.be.null;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!