I am writing code that validates texts. This is how I test it. But I don't want to use try--catch in unit testing. Please give me a better way to do it.
it('Testing if hook errors on invalid description.', async () => {
try {
workRequest.requestor = 'John';
workRequest.description = 1;
result = await app.service('dummy').create(workRequest);
} catch (error) {
assert.equal(error.errors.description, 'Description is must be a string');
}
});