From 1e21b69376f2671f8932bc20160f175ea5f4bbe9 Mon Sep 17 00:00:00 2001 From: mkmandar123 <61929688+mkmandar123@users.noreply.github.com> Date: Tue, 9 Jul 2024 03:37:02 +0530 Subject: [PATCH] test: Object data type should not change from `beforeSave` to `afterSave` trigger (#9177) --- spec/ParseObject.spec.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/ParseObject.spec.js b/spec/ParseObject.spec.js index 11d1705762..b34a945ce1 100644 --- a/spec/ParseObject.spec.js +++ b/spec/ParseObject.spec.js @@ -2120,6 +2120,20 @@ describe('Parse.Object testing', () => { await object.save(); }); + it('should not change the json field to array in afterSave', async () => { + Parse.Cloud.beforeSave('failingJSONTestCase', req => { + expect(req.object.get('jsonField')).toEqual({ '123': 'test' }); + }); + + Parse.Cloud.afterSave('failingJSONTestCase', req => { + expect(req.object.get('jsonField')).toEqual({ '123': 'test' }); + }); + + const object = new Parse.Object('failingJSONTestCase'); + object.set('jsonField', { '123': 'test' }); + await object.save(); + }); + it('returns correct field values', async () => { const values = [ { field: 'string', value: 'string' },