From e0341dd8aca0a1aefa30c1ca873c06fbf572a563 Mon Sep 17 00:00:00 2001 From: Promise Xu Date: Tue, 10 Oct 2017 18:20:52 -0400 Subject: [PATCH 1/2] Fail test case for Issue#3999 --- spec/ParseQuery.spec.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/spec/ParseQuery.spec.js b/spec/ParseQuery.spec.js index 9781d45a89..4f04e46c5c 100644 --- a/spec/ParseQuery.spec.js +++ b/spec/ParseQuery.spec.js @@ -3086,4 +3086,27 @@ describe('Parse.Query testing', () => { done(); }, done.fail); }); + + it('should not interfere with has when using select on field with undefined value #3999', (done) => { + const obj1 = new Parse.Object('TestObject'); + const obj2 = new Parse.Object('OtherObject'); + obj2.set('otherField', 'ok'); + obj1.set('testPointerField', obj2); + obj1.set('shouldBe', true); + const obj3 = new Parse.Object('TestObject'); + obj3.set('shouldBe', false); + Parse.Object.saveAll([obj1, obj3]).then(() => { + const query = new Parse.Query('TestObject'); + query.include('testPointerField'); + query.select(['testPointerField', 'testPointerField.otherField', 'shouldBe']); + return query.find(); + }).then(results => { + results.forEach(result => { + console.log('result: ' + JSON.stringify(result)); + equal(result.has('testPointerField'), result.get('shouldBe')); + }); + done(); + } + ).catch(done.fail); + }); }); From 6e37ea2e15160cf827251dcb90becf5c575e05bb Mon Sep 17 00:00:00 2001 From: Promise Xu Date: Tue, 10 Oct 2017 18:32:26 -0400 Subject: [PATCH 2/2] no message --- spec/ParseQuery.spec.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/ParseQuery.spec.js b/spec/ParseQuery.spec.js index 4f04e46c5c..eb82afab60 100644 --- a/spec/ParseQuery.spec.js +++ b/spec/ParseQuery.spec.js @@ -3090,7 +3090,7 @@ describe('Parse.Query testing', () => { it('should not interfere with has when using select on field with undefined value #3999', (done) => { const obj1 = new Parse.Object('TestObject'); const obj2 = new Parse.Object('OtherObject'); - obj2.set('otherField', 'ok'); + obj2.set('otherField', 1); obj1.set('testPointerField', obj2); obj1.set('shouldBe', true); const obj3 = new Parse.Object('TestObject'); @@ -3102,7 +3102,6 @@ describe('Parse.Query testing', () => { return query.find(); }).then(results => { results.forEach(result => { - console.log('result: ' + JSON.stringify(result)); equal(result.has('testPointerField'), result.get('shouldBe')); }); done();