From cd354004118e8e596524a7681cb44c462833bcf1 Mon Sep 17 00:00:00 2001 From: awgeorge Date: Thu, 27 Apr 2017 21:13:54 -0400 Subject: [PATCH 1/2] Added test for: #3711 --- spec/ParseQuery.spec.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/spec/ParseQuery.spec.js b/spec/ParseQuery.spec.js index b238e24e63..d4c09af040 100644 --- a/spec/ParseQuery.spec.js +++ b/spec/ParseQuery.spec.js @@ -2532,6 +2532,33 @@ describe('Parse.Query testing', () => { }); }); + it("should return a dataset when matching a key in query (#3711)", function(done) { + var SeasonObject = new Parse.Object("Season"); + SeasonObject.set("fullIdentifier", "CD117"); + + return SeasonObject.save().then(() => { + var FixtureObject = new Parse.Object("Fixture"); + FixtureObject.set("season", SeasonObject); + + return Parse.Promise.when(FixtureObject.save()); + }).then((p) => { + + var season = new Parse.Query("Season"); + season.equalTo("fullIdentifier", "CD117"); + + return new Parse.Query("Fixture") + .matchesKeyInQuery("objectId", "season", season) + .find() + .then((r) => { + expect(r.length).toEqual(1); + if (r.length > 0) { + expect(r[0].id).toEqual(p.id); + } + done(); + }, done.fail); + }); + }); + it('should find objects with array of pointers', (done) => { var objects = []; while(objects.length != 5) { From 1b4a18aa05378aeaa71a8dad6f7808ebb076b1d8 Mon Sep 17 00:00:00 2001 From: awgeorge Date: Thu, 27 Apr 2017 23:19:45 -0400 Subject: [PATCH 2/2] Updated test for #3711 --- spec/ParseQuery.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/ParseQuery.spec.js b/spec/ParseQuery.spec.js index d4c09af040..d82a6bf9a5 100644 --- a/spec/ParseQuery.spec.js +++ b/spec/ParseQuery.spec.js @@ -2547,7 +2547,7 @@ describe('Parse.Query testing', () => { season.equalTo("fullIdentifier", "CD117"); return new Parse.Query("Fixture") - .matchesKeyInQuery("objectId", "season", season) + .matchesKeyInQuery("season", "objectId", season) .find() .then((r) => { expect(r.length).toEqual(1);