Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions integration/test/IdempotencyTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ describe('Idempotency', () => {
it('handle duplicate job request', async () => {
DuplicateRequestId('1234');
const params = { startedBy: 'Monty Python' };
const jobStatusId = await Parse.Cloud.startJob('CloudJob1', params);
await expectAsync(Parse.Cloud.startJob('CloudJob1', params)).toBeRejectedWithError(
const jobStatusId = await Parse.Cloud.startJob('CloudJobParamsInMessage', params);
await expectAsync(Parse.Cloud.startJob('CloudJobParamsInMessage', params)).toBeRejectedWithError(
'Duplicate request'
);

Expand All @@ -49,7 +49,7 @@ describe('Idempotency', () => {
}
const jobStatus = await Parse.Cloud.getJobStatus(jobStatusId);
expect(jobStatus.get('status')).toBe('succeeded');
expect(jobStatus.get('params').startedBy).toBe('Monty Python');
expect(JSON.parse(jobStatus.get('message'))).toEqual(params);
});

it('handle duplicate POST / PUT request', async () => {
Expand Down
6 changes: 3 additions & 3 deletions integration/test/ParseCloudTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ describe('Parse Cloud', () => {

it('run job', async () => {
const params = { startedBy: 'Monty Python' };
const jobStatusId = await Parse.Cloud.startJob('CloudJob1', params);
const jobStatusId = await Parse.Cloud.startJob('CloudJobParamsInMessage', params);
expect(jobStatusId).toBeDefined();
await waitForJobStatus(jobStatusId, 'succeeded');

const jobStatus = await Parse.Cloud.getJobStatus(jobStatusId);
assert.equal(jobStatus.get('status'), 'succeeded');
assert.equal(jobStatus.get('params').startedBy, 'Monty Python');
expect(jobStatus.get('status')).toBe('succeeded');
expect(JSON.parse(jobStatus.get('message'))).toEqual(params);
});

it('run long job', async () => {
Expand Down
4 changes: 4 additions & 0 deletions integration/test/cloud/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ Parse.Cloud.job('CloudJob2', function () {
});
});

Parse.Cloud.job('CloudJobParamsInMessage', request => {
request.message(JSON.stringify(request.params));
});

Parse.Cloud.job('CloudJobFailing', function () {
throw 'cloud job failed';
});
2 changes: 1 addition & 1 deletion integration/test/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const defaultConfiguration = {
},
},
idempotencyOptions: {
paths: ['functions/CloudFunctionIdempotency', 'jobs/CloudJob1', 'classes/IdempotentTest'],
paths: ['functions/CloudFunctionIdempotency', 'jobs/CloudJob1', 'jobs/CloudJobParamsInMessage', 'classes/IdempotentTest'],
ttl: 120,
},
fileUpload: {
Expand Down
Loading