Remaining service tests
We already have a structure to easily implement the remaining tests.
describe('otherwise', () => {
it('should propagate the exception', async () => {
const id = 1;
const exception = new NotFoundException('User not found');
repository.findOneByOrFail.mockRejectedValueOnce(exception);
let error: Error;
try {
await service.findOne(id);
} catch (err) {
error = err;
}
expect(error).toBe(exception);
});
});Last updated