Skip to content

Commit

Permalink
add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
dplewis committed May 8, 2023
1 parent 3ea195f commit 34ca68e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions spec/ParseLiveQuery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const Auth = require('../lib/Auth');
const UserController = require('../lib/Controllers/UserController').UserController;
const Config = require('../lib/Config');
const triggers = require('../lib/triggers');
const validatorFail = () => {
throw 'you are not authorized';
};
Expand Down Expand Up @@ -1212,4 +1213,25 @@ describe('ParseLiveQuery', function () {
object.set({ location: secondPoint });
await object.save();
});

it('prevent afterSave trigger if not exists', async () => {
await reconfigureServer({
liveQuery: {
classNames: ['TestObject'],
},
startLiveQueryServer: true,
verbose: false,
silent: true,
});
spyOn(triggers, 'maybeRunTrigger').and.callThrough();
const object1 = new TestObject();
const object2 = new TestObject();
const object3 = new TestObject();
await Parse.Object.saveAll([object1, object2, object3]);

expect(triggers.maybeRunTrigger).toHaveBeenCalledTimes(0);
expect(object1.id).toBeDefined();
expect(object2.id).toBeDefined();
expect(object3.id).toBeDefined();
});
});

0 comments on commit 34ca68e

Please sign in to comment.