Skip to content

Commit bc68816

Browse files
committed
wip
1 parent 207c3c0 commit bc68816

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

spec/CloudCode.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ describe('Cloud Code', () => {
206206
});
207207
Parse.Cloud.afterFind('beforeFind', req => {
208208
expect(req.objects).toBeDefined();
209-
expect(req.objects[0].className).toBe('TestObject');
209+
expect(req.objects[0].get('foo')).toBe('bar');
210210
});
211211
const newObj = await new Parse.Query('beforeFind').first();
212212
expect(newObj.className).toBe('TestObject');
@@ -220,7 +220,7 @@ describe('Cloud Code', () => {
220220
});
221221
Parse.Cloud.afterFind('beforeFind', req => {
222222
expect(req.objects).toBeDefined();
223-
expect(req.objects[0].className).toBe('TestObject');
223+
expect(req.objects[0].get('foo')).toBe('bar');
224224
});
225225
const newObj = await new Parse.Query('beforeFind').first();
226226
expect(newObj.className).toBe('TestObject');
@@ -234,7 +234,7 @@ describe('Cloud Code', () => {
234234
});
235235
Parse.Cloud.afterFind('beforeFind', req => {
236236
expect(req.objects).toBeDefined();
237-
expect(req.objects[0].className).toBe('TestObject');
237+
expect(req.objects[0].get('foo')).toBe('bar');
238238
});
239239
const newObj = await new Parse.Query('beforeFind').get('objId');
240240
expect(newObj.className).toBe('TestObject');
@@ -246,8 +246,8 @@ describe('Cloud Code', () => {
246246
Parse.Cloud.beforeFind('beforeFind', () => {
247247
return [];
248248
});
249-
Parse.Cloud.afterFind('beforeFind', () => {
250-
throw 'afterFind should not run';
249+
Parse.Cloud.afterFind('beforeFind', req => {
250+
expect(req.objects.length).toBe(0);
251251
});
252252
const obj = new Parse.Object('beforeFind');
253253
await obj.save();

src/triggers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,10 @@ export function maybeRunAfterFindTrigger(
454454
);
455455
request.objects = objects.map(object => {
456456
//setting the class name to transform into parse object
457+
object.className = className;
457458
if (object instanceof Parse.Object) {
458459
return object;
459460
}
460-
object.className = className;
461461
return Parse.Object.fromJSON(object);
462462
});
463463
return Promise.resolve()

0 commit comments

Comments
 (0)