diff --git a/spec/ParseQuery.spec.js b/spec/ParseQuery.spec.js index 9781d45a89..eb82afab60 100644 --- a/spec/ParseQuery.spec.js +++ b/spec/ParseQuery.spec.js @@ -3086,4 +3086,26 @@ 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', 1); + 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 => { + equal(result.has('testPointerField'), result.get('shouldBe')); + }); + done(); + } + ).catch(done.fail); + }); });