Skip to content
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

fix(direct-access): save context not present if direct access enabled #6764

Merged
merged 6 commits into from
Jul 17, 2020
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
22 changes: 19 additions & 3 deletions spec/ParseServerRESTController.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ describe('ParseServerRESTController', () => {
expect(databaseAdapter.createObject.calls.argsFor(0)[3]).toBe(
databaseAdapter.createObject.calls.argsFor(1)[3]
);
expect(results.map(result => result.get('key')).sort()).toEqual(
['value1', 'value2']
);
expect(
results.map(result => result.get('key')).sort()
).toEqual(['value1', 'value2']);
done();
});
});
Expand Down Expand Up @@ -517,6 +517,22 @@ describe('ParseServerRESTController', () => {
});
});

it('should handle a POST request with context', async () => {
Parse.Cloud.beforeSave('MyObject', req => {
expect(req.context.a).toEqual('a');
});
Parse.Cloud.afterSave('MyObject', req => {
expect(req.context.a).toEqual('a');
});

await RESTController.request(
'POST',
'/classes/MyObject',
{ key: 'value' },
{ context: { a: 'a' } }
);
});

it('ensures sessionTokens are properly handled', done => {
let userId;
Parse.User.signUp('user', 'pass')
Expand Down