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

Commit 234c3d60 by Daniel Durante

Fixed up MySQL dialect.

1 parent cf2581ed
...@@ -289,20 +289,24 @@ describe(Helpers.getTestDialectTeaser("HasMany"), function() { ...@@ -289,20 +289,24 @@ describe(Helpers.getTestDialectTeaser("HasMany"), function() {
Parent.hasMany(Child, {as: 'Children', foreignKey: 'child_id', joinTableName: 'ParentRelationship'}) Parent.hasMany(Child, {as: 'Children', foreignKey: 'child_id', joinTableName: 'ParentRelationship'})
Child.hasMany(Parent, {as: 'Parents', foreignKey: 'parent_id', joinTableName: 'ParentRelationship'}) Child.hasMany(Parent, {as: 'Parents', foreignKey: 'parent_id', joinTableName: 'ParentRelationship'})
this.sequelize.sync({ force: true }).success(function() { ParentJoin.sync({ force: true }).success(function() {
Parent.create({name: 'mom'}).success(function(mom) { Parent.sync({ force: true }).success(function() {
parents.push(mom) Child.sync({ force: true }).success(function() {
Parent.create({name: 'dad'}).success(function(dad) { Parent.create({name: 'mom'}).success(function(mom) {
parents.push(dad) parents.push(mom)
Child.create({name: 'baby'}).success(function(baby) { Parent.create({name: 'dad'}).success(function(dad) {
baby.setParents(parents).success(function(){ parents.push(dad)
parents[0].getChildren().success(function(children){ Child.create({name: 'baby'}).success(function(baby) {
expect(children).not.toBe(null) baby.setParents(parents).success(function(){
expect(children.length).toBeDefined() parents[0].getChildren().success(function(children){
expect(children.length).toEqual(1) expect(children).not.toBe(null)
expect(children[0]).toBeDefined() expect(children.length).toBeDefined()
expect(children[0].name).toEqual('baby') expect(children.length).toEqual(1)
done() expect(children[0]).toBeDefined()
expect(children[0].name).toEqual('baby')
done()
})
})
}) })
}) })
}) })
......
...@@ -2445,8 +2445,11 @@ describe(Helpers.getTestDialectTeaser("DAOFactory"), function() { ...@@ -2445,8 +2445,11 @@ describe(Helpers.getTestDialectTeaser("DAOFactory"), function() {
}) })
describe('use of invalid table name', function() { describe('use of invalid table name', function() {
before(function(done) { it("emits the error event as the referenced table name is invalid", function(done) {
this.Post = this.sequelize.define('post', { this.timeout = 3500
var self = this
self.Post = self.sequelize.define('post', {
title: Sequelize.STRING, title: Sequelize.STRING,
authorId: { authorId: {
type: Sequelize.INTEGER, type: Sequelize.INTEGER,
...@@ -2455,15 +2458,10 @@ describe(Helpers.getTestDialectTeaser("DAOFactory"), function() { ...@@ -2455,15 +2458,10 @@ describe(Helpers.getTestDialectTeaser("DAOFactory"), function() {
} }
}) })
this.Author.hasMany(this.Post) self.Author.hasMany(self.Post)
this.Post.belongsTo(this.Author) self.Post.belongsTo(self.Author)
done()
})
it("emits the error event as the referenced table name is invalid", function(done) { self.Author.sync({ force: true }).success(function() {
this.timeout = 2500
var self = this
this.Author.sync({ force: true }).success(function() {
self.Post.sync({ force: true }).success(function() { self.Post.sync({ force: true }).success(function() {
if (dialect === 'sqlite') { if (dialect === 'sqlite') {
// sorry ... but sqlite is too stupid to understand whats going on ... // sorry ... but sqlite is too stupid to understand whats going on ...
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!