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

Commit b711ab94 by sdepold

make sure sync is only creating the expected number tables

1 parent a3c33db0
Showing with 16 additions and 1 deletions
......@@ -20,7 +20,7 @@ describe('HasMany', function() {
.error(function(err) { console.log(err) })
})
describe('Many To One', function() {
describe('(1:N)', function() {
describe('hasSingle', function() {
before(function(done) {
var self = this
......@@ -145,6 +145,21 @@ describe('HasMany', function() {
expect(Task.attributes.UserId).not.toBeDefined()
})
it("adds three items to the query chainer when calling sync", function() {
var User = sequelize.define('User', { username: Sequelize.STRING })
, Task = sequelize.define('Task', { title: Sequelize.STRING })
User.hasMany(Task)
Task.hasMany(User)
var add = this.spy()
this.stub(Sequelize.Utils, 'QueryChainer').returns({ add: add, run: function(){} })
sequelize.sync({ force: true })
expect(add).toHaveBeenCalledThrice()
})
it("=>clears associations when passing null to the set-method", function(done) {
var User = sequelize.define('User', { username: Sequelize.STRING })
, Task = sequelize.define('Task', { title: Sequelize.STRING })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!