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

Commit 3a40d1c9 by Sascha Depold

Add test that ensures allowNull

This commit adds a test that checks allowNull in combination with
primaryKey.
1 parent 49b6352f
Showing with 25 additions and 0 deletions
...@@ -134,6 +134,31 @@ describe(Support.getTestDialectTeaser("Model"), function () { ...@@ -134,6 +134,31 @@ describe(Support.getTestDialectTeaser("Model"), function () {
]); ]);
}); });
describe('primaryKey', function () {
describe('in combination with allowNull', function () {
beforeEach(function () {
this.ModelUnderTest = this.sequelize.define('ModelUnderTest', {
identifier: {
primaryKey: true,
type: Sequelize.STRING,
allowNull: false
}
});
return this.ModelUnderTest.sync({ force: true });
});
it('sets the column to not allow null', function () {
return this
.ModelUnderTest
.describe()
.then(function (fields) {
expect(fields.identifier).to.include({ allowNull: false });
});
});
});
});
describe('field and attribute name is the same', function () { describe('field and attribute name is the same', function () {
beforeEach(function () { beforeEach(function () {
return this.Comment.bulkCreate([ return this.Comment.bulkCreate([
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!