Skip to content

Commit 6fd92c8

Browse files
committed
⚡ regression test for #1288
1 parent f99b558 commit 6fd92c8

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

spec/ParseAPI.spec.js

+30
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,36 @@ describe('miscellaneous', function() {
618618
});
619619
});
620620

621+
it('pointer reassign is working properly (#1288)', (done) => {
622+
Parse.Cloud.beforeSave('GameScore', (req, res) => {
623+
624+
var obj = req.object;
625+
if (obj.get('point')) {
626+
return res.success();
627+
}
628+
var TestObject1 = Parse.Object.extend('TestObject1');
629+
var newObj = new TestObject1({'key1': 1});
630+
631+
return newObj.save().then((newObj) => {
632+
obj.set('point' , newObj);
633+
res.success();
634+
});
635+
});
636+
var pointId;
637+
var obj = new Parse.Object('GameScore');
638+
obj.set('foo', 'bar');
639+
obj.save().then(() => {
640+
expect(obj.get('point')).not.toBeUndefined();
641+
pointId = obj.get('point').id;
642+
expect(pointId).not.toBeUndefined();
643+
obj.set('foo', 'baz');
644+
return obj.save();
645+
}).then((obj) => {
646+
expect(obj.get('point').id).toEqual(pointId);
647+
done();
648+
})
649+
});
650+
621651
it('test afterSave get full object on create and update', function(done) {
622652
var triggerTime = 0;
623653
// Register a mock beforeSave hook

0 commit comments

Comments
 (0)