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

Commit 234c3d60 by Daniel Durante

Fixed up MySQL dialect.

1 parent cf2581ed
......@@ -289,20 +289,24 @@ describe(Helpers.getTestDialectTeaser("HasMany"), function() {
Parent.hasMany(Child, {as: 'Children', foreignKey: 'child_id', joinTableName: 'ParentRelationship'})
Child.hasMany(Parent, {as: 'Parents', foreignKey: 'parent_id', joinTableName: 'ParentRelationship'})
this.sequelize.sync({ force: true }).success(function() {
Parent.create({name: 'mom'}).success(function(mom) {
parents.push(mom)
Parent.create({name: 'dad'}).success(function(dad) {
parents.push(dad)
Child.create({name: 'baby'}).success(function(baby) {
baby.setParents(parents).success(function(){
parents[0].getChildren().success(function(children){
expect(children).not.toBe(null)
expect(children.length).toBeDefined()
expect(children.length).toEqual(1)
expect(children[0]).toBeDefined()
expect(children[0].name).toEqual('baby')
done()
ParentJoin.sync({ force: true }).success(function() {
Parent.sync({ force: true }).success(function() {
Child.sync({ force: true }).success(function() {
Parent.create({name: 'mom'}).success(function(mom) {
parents.push(mom)
Parent.create({name: 'dad'}).success(function(dad) {
parents.push(dad)
Child.create({name: 'baby'}).success(function(baby) {
baby.setParents(parents).success(function(){
parents[0].getChildren().success(function(children){
expect(children).not.toBe(null)
expect(children.length).toBeDefined()
expect(children.length).toEqual(1)
expect(children[0]).toBeDefined()
expect(children[0].name).toEqual('baby')
done()
})
})
})
})
})
......
......@@ -2445,8 +2445,11 @@ describe(Helpers.getTestDialectTeaser("DAOFactory"), function() {
})
describe('use of invalid table name', function() {
before(function(done) {
this.Post = this.sequelize.define('post', {
it("emits the error event as the referenced table name is invalid", function(done) {
this.timeout = 3500
var self = this
self.Post = self.sequelize.define('post', {
title: Sequelize.STRING,
authorId: {
type: Sequelize.INTEGER,
......@@ -2455,15 +2458,10 @@ describe(Helpers.getTestDialectTeaser("DAOFactory"), function() {
}
})
this.Author.hasMany(this.Post)
this.Post.belongsTo(this.Author)
done()
})
self.Author.hasMany(self.Post)
self.Post.belongsTo(self.Author)
it("emits the error event as the referenced table name is invalid", function(done) {
this.timeout = 2500
var self = this
this.Author.sync({ force: true }).success(function() {
self.Author.sync({ force: true }).success(function() {
self.Post.sync({ force: true }).success(function() {
if (dialect === 'sqlite') {
// 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!