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

write test case to expose vacum getter bug

1 parent d480d382
Showing with 38 additions and 0 deletions
...@@ -9,6 +9,7 @@ var chai = require('chai') ...@@ -9,6 +9,7 @@ var chai = require('chai')
, datetime = require('chai-datetime') , datetime = require('chai-datetime')
, uuid = require('node-uuid') , uuid = require('node-uuid')
, _ = require('lodash') , _ = require('lodash')
, Promise = require('bluebird')
chai.use(datetime) chai.use(datetime)
chai.Assertion.includeStack = true chai.Assertion.includeStack = true
...@@ -1050,6 +1051,43 @@ describe(Support.getTestDialectTeaser("DAO"), function () { ...@@ -1050,6 +1051,43 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
}) })
}) })
}) })
describe('many to many relations', function() {
var udo;
beforeEach(function(done) {
var self = this
this.User = this.sequelize.define('UserWithUsernameAndAgeAndIsAdmin', {
username: DataTypes.STRING,
age: DataTypes.INTEGER,
isAdmin: DataTypes.BOOLEAN
}, {timestamps: false})
this.Project = this.sequelize.define('NiceProject',
{ title: DataTypes.STRING }, {timestamps: false})
this.Project.hasMany(this.User)
this.User.hasMany(this.Project)
this.User.sync({ force: true }).success(function() {
self.Project.sync({ force: true }).success(function() {
self.User.create({ username: 'fnord', age: 1, isAdmin: true })
.success(function(user) {
udo = user
done()
})
})
})
})
it('Should assign a property to the instance', function(done) {
var self = this;
this.User.find({id: udo.id})
.success(function(user) {
user.NiceProjectId = 1;
expect(user.NiceProjectId).to.equal(1);
done();
})
})
})
describe('toJSON', function() { describe('toJSON', function() {
beforeEach(function(done) { beforeEach(function(done) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!