Skip to content

Commit 18279b2

Browse files
authored
Merge branch 'alpha' into alpha
2 parents a8bb14b + d2bdb27 commit 18279b2

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

integration/test/IdempotencyTest.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ describe('Idempotency', () => {
3535
it('handle duplicate job request', async () => {
3636
DuplicateRequestId('1234');
3737
const params = { startedBy: 'Monty Python' };
38-
const jobStatusId = await Parse.Cloud.startJob('CloudJob1', params);
39-
await expectAsync(Parse.Cloud.startJob('CloudJob1', params)).toBeRejectedWithError(
38+
const jobStatusId = await Parse.Cloud.startJob('CloudJobParamsInMessage', params);
39+
await expectAsync(Parse.Cloud.startJob('CloudJobParamsInMessage', params)).toBeRejectedWithError(
4040
'Duplicate request'
4141
);
4242

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

5555
it('handle duplicate POST / PUT request', async () => {

integration/test/ParseCloudTest.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ describe('Parse Cloud', () => {
9595

9696
it('run job', async () => {
9797
const params = { startedBy: 'Monty Python' };
98-
const jobStatusId = await Parse.Cloud.startJob('CloudJob1', params);
98+
const jobStatusId = await Parse.Cloud.startJob('CloudJobParamsInMessage', params);
9999
expect(jobStatusId).toBeDefined();
100100
await waitForJobStatus(jobStatusId, 'succeeded');
101101

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

107107
it('run long job', async () => {
@@ -137,7 +137,7 @@ describe('Parse Cloud', () => {
137137
it('get jobs data', done => {
138138
Parse.Cloud.getJobsData().then(result => {
139139
assert.equal(result.in_use.length, 0);
140-
assert.equal(result.jobs.length, 3);
140+
assert.equal(result.jobs.length, 4);
141141
done();
142142
});
143143
});

integration/test/cloud/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ Parse.Cloud.job('CloudJob2', function () {
4545
});
4646
});
4747

48+
Parse.Cloud.job('CloudJobParamsInMessage', request => {
49+
request.message(JSON.stringify(request.params));
50+
});
51+
4852
Parse.Cloud.job('CloudJobFailing', function () {
4953
throw 'cloud job failed';
5054
});

integration/test/helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const defaultConfiguration = {
7474
},
7575
},
7676
idempotencyOptions: {
77-
paths: ['functions/CloudFunctionIdempotency', 'jobs/CloudJob1', 'classes/IdempotentTest'],
77+
paths: ['functions/CloudFunctionIdempotency', 'jobs/CloudJob1', 'jobs/CloudJobParamsInMessage', 'classes/IdempotentTest'],
7878
ttl: 120,
7979
},
8080
fileUpload: {

0 commit comments

Comments
 (0)