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

You need to sign in or sign up before continuing.
Commit cefcda37 by Joe Lutz

Fix test 'should support renaming of sequelize method fields'

1 parent e7c0351e
Showing with 18 additions and 18 deletions
...@@ -257,27 +257,27 @@ describe(Support.getTestDialectTeaser("Model"), function () { ...@@ -257,27 +257,27 @@ describe(Support.getTestDialectTeaser("Model"), function () {
}); });
}); });
it('should support renaming of sequelize method fields', function () { it('should support renaming of sequelize method fields', function () {
var User = this.sequelize.define('user', { var Test = this.sequelize.define('test', {
someProperty: Sequelize.VIRTUAL // Since we specify the AS part as a part of the literal string, not with sequelize syntax, we have to tell sequelize about the field someProperty: Sequelize.VIRTUAL // Since we specify the AS part as a part of the literal string, not with sequelize syntax, we have to tell sequelize about the field
}); });
return this.sequelize.sync({ force: true }).then(function () { return this.sequelize.sync({ force: true }).then(function () {
return User.create({}); return Test.create({});
}).then(function () { }).then(function () {
return User.findAll({ return Test.findAll({
attributes: [ attributes: [
Sequelize.literal('EXISTS(SELECT 1) AS "someProperty"'), Sequelize.literal('EXISTS(SELECT 1) AS "someProperty"'),
[Sequelize.literal('EXISTS(SELECT 1)'), 'someProperty2'] [Sequelize.literal('EXISTS(SELECT 1)'), 'someProperty2']
] ]
});
}).then(function (tests) {
expect(tests[0].get('someProperty')).to.be.ok;
expect(tests[0].get('someProperty2')).to.be.ok;
}); });
}).then(function (users) {
expect(users[0].get('someProperty')).to.be.ok;
expect(users[0].get('someProperty2')).to.be.ok;
}); });
});
it('field names that are the same as property names should create, update, and read correctly', function () {
it('field names that are the same as property names should create, update, and read correctly', function () {
var self = this; var self = this;
return this.Comment.create({ return this.Comment.create({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!