LiveQueryEvent Error Logging Improvements (#6951)
* LiveQueryEvent Improvements * Update ParseLiveQueryServer.js * Update ParseLiveQueryServer.js * More Tests * Update ParseLiveQueryServer.js * Pass thrown errors to subscription * Update ParseLiveQueryServer.js * Update ParseLiveQueryServer.js * Remove ACL error
This commit is contained in:
@@ -231,7 +231,6 @@ describe('ParseLiveQuery', function () {
|
||||
object.set({ foo: 'bar' });
|
||||
await object.save();
|
||||
});
|
||||
|
||||
it('can handle afterEvent throw', async done => {
|
||||
await reconfigureServer({
|
||||
liveQuery: {
|
||||
@@ -245,6 +244,37 @@ describe('ParseLiveQuery', function () {
|
||||
const object = new TestObject();
|
||||
await object.save();
|
||||
|
||||
Parse.Cloud.afterLiveQueryEvent('TestObject', () => {
|
||||
throw 'Throw error from LQ afterEvent.';
|
||||
});
|
||||
|
||||
const query = new Parse.Query(TestObject);
|
||||
query.equalTo('objectId', object.id);
|
||||
const subscription = await query.subscribe();
|
||||
subscription.on('update', () => {
|
||||
fail('update should not have been called.');
|
||||
});
|
||||
subscription.on('error', e => {
|
||||
expect(e).toBe('Throw error from LQ afterEvent.');
|
||||
done();
|
||||
});
|
||||
object.set({ foo: 'bar' });
|
||||
await object.save();
|
||||
});
|
||||
|
||||
it('can handle afterEvent sendEvent to false', async done => {
|
||||
await reconfigureServer({
|
||||
liveQuery: {
|
||||
classNames: ['TestObject'],
|
||||
},
|
||||
startLiveQueryServer: true,
|
||||
verbose: false,
|
||||
silent: true,
|
||||
});
|
||||
|
||||
const object = new TestObject();
|
||||
await object.save();
|
||||
|
||||
Parse.Cloud.afterLiveQueryEvent('TestObject', req => {
|
||||
const current = req.object;
|
||||
const original = req.original;
|
||||
@@ -254,7 +284,7 @@ describe('ParseLiveQuery', function () {
|
||||
}, 2000);
|
||||
|
||||
if (current.get('foo') != original.get('foo')) {
|
||||
throw "Don't pass an update trigger, or message";
|
||||
req.sendEvent = false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user