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

Commit a6dc86a4 by XadillaX

add integration test for multiple primary keys destroy

1 parent 818f7077
Showing with 32 additions and 0 deletions
......@@ -1759,6 +1759,38 @@ describe(Support.getTestDialectTeaser('Instance'), function() {
});
});
});
it('delete a record of multiple primary keys table', function() {
var MultiPrimary = this.sequelize.define('MultiPrimary', {
bilibili: {
type: Support.Sequelize.CHAR(2),
primaryKey: true
},
guruguru: {
type: Support.Sequelize.CHAR(2),
primaryKey: true
}
});
return MultiPrimary.sync({ force: true }).then(function() {
return MultiPrimary.create({ bilibili: 'bl', guruguru: 'gu' }).then(function() {
return MultiPrimary.create({ bilibili: 'bl', guruguru: 'ru' }).then(function(m2) {
return MultiPrimary.findAll().then(function(ms) {
expect(ms.length).to.equal(2);
return m2.destroy({
logging: function(sql) {
expect(sql).to.exist;
expect(sql.toUpperCase().indexOf('DELETE')).to.be.above(-1);
expect(sql.indexOf('ru')).to.be.above(-1);
expect(sql.indexOf('bl')).to.be.above(-1);
}
});
});
});
});
});
});
});
describe('restore', function() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!