Skip to content

Commit 21c9289

Browse files
committed
Update CloudCode.spec.js
1 parent 41bf1b7 commit 21c9289

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

spec/CloudCode.spec.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,10 @@ describe('Cloud Code', () => {
208208
Parse.Cloud.afterFind('beforeFind', () => {
209209
throw 'afterFind should not run';
210210
});
211-
const obj = new Parse.Object('beforeFind');
212-
await obj.save();
213211
const newObj = await new Parse.Query('beforeFind').first();
214212
expect(newObj.className).toBe('TestObject');
215213
expect(newObj.toJSON()).toEqual({ foo: 'bar' });
214+
await newObj.save();
216215
});
217216

218217
it('beforeFind can return array of objects without DB operation', async () => {
@@ -222,11 +221,10 @@ describe('Cloud Code', () => {
222221
Parse.Cloud.afterFind('beforeFind', () => {
223222
throw 'afterFind should not run';
224223
});
225-
const obj = new Parse.Object('beforeFind');
226-
await obj.save();
227224
const newObj = await new Parse.Query('beforeFind').first();
228225
expect(newObj.className).toBe('TestObject');
229226
expect(newObj.toJSON()).toEqual({ foo: 'bar' });
227+
await newObj.save();
230228
});
231229

232230
it('beforeFind can return object for get query without DB operation', async () => {
@@ -236,11 +234,10 @@ describe('Cloud Code', () => {
236234
Parse.Cloud.afterFind('beforeFind', () => {
237235
throw 'afterFind should not run';
238236
});
239-
const obj = new Parse.Object('beforeFind');
240-
await obj.save();
241-
const newObj = await new Parse.Query('beforeFind').get(obj.id);
237+
const newObj = await new Parse.Query('beforeFind').get('objId');
242238
expect(newObj.className).toBe('TestObject');
243239
expect(newObj.toJSON()).toEqual({ foo: 'bar' });
240+
await newObj.save();
244241
});
245242

246243
it('beforeFind can return empty array without DB operation', async () => {

0 commit comments

Comments
 (0)