From 97d3deb73b815ac757567ae2f9a30e218d19aba4 Mon Sep 17 00:00:00 2001 From: Drew Gross Date: Wed, 30 Mar 2016 13:23:21 -0700 Subject: [PATCH] Regression test for #871 --- spec/ParseRelation.spec.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/spec/ParseRelation.spec.js b/spec/ParseRelation.spec.js index fa409f2f45..8b38a8e31c 100644 --- a/spec/ParseRelation.spec.js +++ b/spec/ParseRelation.spec.js @@ -652,4 +652,31 @@ describe('Parse.Relation testing', () => { })); }); }); + + it('relations are not bidirectional (regression test for #871)', done => { + let PersonObject = Parse.Object.extend("Person"); + let p1 = new PersonObject(); + let p2 = new PersonObject(); + Parse.Object.saveAll([p1, p2]).then(results => { + let p1 = results[0]; + let p2 = results[1]; + let relation = p1.relation('relation'); + relation.add(p2); + p1.save().then(() => { + let query = new Parse.Query(PersonObject); + query.equalTo('relation', p1); + query.find().then(results => { + expect(results.length).toEqual(0); + + let query = new Parse.Query(PersonObject); + query.equalTo('relation', p2); + query.find().then(results => { + expect(results.length).toEqual(1); + expect(results[0].objectId).toEqual(p1.objectId); + done(); + }); + }); + }) + }); + }); });