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

Commit 6825450d by Seth Samuel

More promises

1 parent 1007ac22
Showing with 13 additions and 21 deletions
...@@ -457,38 +457,30 @@ if (dialect.match(/^postgres/)) { ...@@ -457,38 +457,30 @@ if (dialect.match(/^postgres/)) {
}) })
}) })
it("should read hstore correctly", function(done) { it("should read hstore correctly", function() {
var self = this var self = this
var data = { username: 'user', email: ['foo@bar.com'], settings: { test: '"value"' }} var data = { username: 'user', email: ['foo@bar.com'], settings: { test: '"value"' }}
this.User return this.User.create(data)
.create(data) .then(function() {
.success(function() { return self.User.find({ where: { username: 'user' }})
})
.then(function(user){
// Check that the hstore fields are the same when retrieving the user // Check that the hstore fields are the same when retrieving the user
self.User.find({ where: { username: 'user' }}) expect(user.settings).to.deep.equal(data.settings)
.success(function(user) {
expect(user.settings).to.deep.equal(data.settings)
done()
})
}) })
.error(console.log)
}) })
it('should read an hstore array correctly', function(done) { it('should read an hstore array correctly', function() {
var self = this var self = this
var data = { username: 'user', email: ['foo@bar.com'], phones: [{ number: '123456789', type: 'mobile' }, { number: '987654321', type: 'landline' }] } var data = { username: 'user', email: ['foo@bar.com'], phones: [{ number: '123456789', type: 'mobile' }, { number: '987654321', type: 'landline' }] }
this.User return this.User.create(data)
.create(data) .then(function() {
.success(function() {
// Check that the hstore fields are the same when retrieving the user // Check that the hstore fields are the same when retrieving the user
self.User.find({ where: { username: 'user' }}) return self.User.find({ where: { username: 'user' }});
.success(function(user) { }).then(function(user) {
expect(user.phones).to.deep.equal(data.phones) expect(user.phones).to.deep.equal(data.phones)
done()
})
}) })
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!