Consider the following test in test/relations.test.js, describe("hasAndBelongsToMany"):
it('should destroy all related instances', function(done) {
Article.findOne(function (e, article) {
article.tags.destroyAll(function(err) {
if (err) return done(err);
article.tags(true, function(err, list) {
if (err) return done(err);
list.should.have.length(0);
});
});
});
});
// result
// AssertionError: expected [ null ] to have a length of 0 but got 1
/to @raymondfeng
Consider the following test in test/relations.test.js, describe("hasAndBelongsToMany"):
/to @raymondfeng