Skip to content

Commit

Permalink
test: Object data type should not change from beforeSave to `afterS…
Browse files Browse the repository at this point in the history
…ave` trigger (parse-community#9177)
  • Loading branch information
mkmandar123 authored Jul 8, 2024
1 parent 3353998 commit 1e21b69
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions spec/ParseObject.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand Down

0 comments on commit 1e21b69

Please sign in to comment.