We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 34825ac commit bb9a507Copy full SHA for bb9a507
test/instance_db.js
@@ -109,6 +109,31 @@ describe('orm', function () {
109
});
110
111
112
+
113
+ describe('update', function() {
114
+ it('should retrieve the latest version of the model from the database', function(done) {
115
+ model.findOne('billy', function(err, billy1) {
116
+ if(err) return done(err);
117
118
+ model.findOne('billy', function(err, billy2) {
119
120
121
+ billy1.age++;
122
+ billy1.save(function(err) {
123
124
+ billy2.age.should.eql(billy1.age - 1);
125
126
+ billy2.update(function(err) {
127
128
129
+ billy2.age.should.eql(billy1.age);
130
+ done();
131
+ });
132
+ })
133
134
135
136
137
138
139
0 commit comments