Skip to content

Adds repro for #1931 #2735

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 1 commit into from
Sep 24, 2016
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
26 changes: 26 additions & 0 deletions spec/CloudCode.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,32 @@ describe('Cloud Code', () => {
done();
});
});

it('beforeSave change propagates through the afterSave #1931', (done) => {
Parse.Cloud.beforeSave('ChangingObject', function(request, response) {
request.object.unset('file');
request.object.unset('date');
response.success();
});

Parse.Cloud.afterSave('ChangingObject', function(request, response) {
let json = request.object.toJSON();
expect(request.object.has("file")).toBe(false);
expect(request.object.has("date")).toBe(false);
expect(request.object.get('file')).toBeUndefined();
return Promise.resolve();
});
let file = new Parse.File("yolo.txt", [1,2,3], "text/plain");
file.save().then(() => {
let obj = new Parse.Object('ChangingObject');
return obj.save({ file, date: new Date() })
}).then(() => {
done();
}, () => {
fail();
done();
})
});

it('test cloud function parameter validation success', (done) => {
// Register a function with validation
Expand Down