You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a beforeSave trigger that validates objects and throws errors if they fail validation. I want to test that this validation is working as expected.
I can't figure out how to catch the exception / error and prevent Jasmine from failing. Even if I try a structure like this, Jasmine fails early, the catch() block is never even called. I suspect because it's catching the console error thrown by the server backend first. I would have expected the spyOn function to catch that.
// ...beforeEach((done)=>{spyOn(console,'error');dropDB().then(done).catch(done.fail);});// ...it('should reject invalid items',async(done)=>{// Set up an `item` for saving.try{awaititem.save(null,{sessionToken: user.getSessionToken()})}catch(error){// check error, etc. This is never even called, even though beforeSave is definitely throwing an exception.done();}}
The text was updated successfully, but these errors were encountered:
I have a beforeSave trigger that validates objects and throws errors if they fail validation. I want to test that this validation is working as expected.
I can't figure out how to catch the exception / error and prevent Jasmine from failing. Even if I try a structure like this, Jasmine fails early, the catch() block is never even called. I suspect because it's catching the console error thrown by the server backend first. I would have expected the spyOn function to catch that.
The text was updated successfully, but these errors were encountered: