Skip to content

Commit

Permalink
feat: Add support to invoke a Cloud Function with a custom `installat…
Browse files Browse the repository at this point in the history
…ionId` via `Parse.Cloud.run` (#1939)
  • Loading branch information
mtrezza authored Jun 11, 2023
1 parent 473babf commit eb70b93
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/Cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export function run(name: string, data: mixed, options: RequestOptions): Promise
if (options.sessionToken) {
requestOptions.sessionToken = options.sessionToken;
}
if (options.installationId) {
requestOptions.installationId = options.installationId;
}
if (options.context && typeof options.context === 'object') {
requestOptions.context = options.context;
}
Expand Down
9 changes: 9 additions & 0 deletions src/__tests__/Cloud-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ describe('Cloud', () => {
]);
});

it('run passes installationId option', () => {
Cloud.run('myfunction', {}, { installationId: 'asdf1234' });
expect(CoreManager.getCloudController().run.mock.calls[0]).toEqual([
'myfunction',
{},
{ installationId: 'asdf1234' },
]);
});

it('startJob throws with an invalid job name', () => {
expect(Cloud.startJob).toThrow('Cloud job name must be a string.');

Expand Down

0 comments on commit eb70b93

Please sign in to comment.