Skip to content

test: Object data type should not change from beforeSave to afterSave trigger #9177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading