Skip to content

Commit

Permalink
update test to expect a console error since that's what happens
Browse files Browse the repository at this point in the history
  • Loading branch information
intcreator authored Jan 9, 2025
1 parent 2891f16 commit 21cb4a6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/cron.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1176,17 +1176,17 @@ describe('cron', () => {
clock.restore();
});

it('should throw errors if errorHandler is NOT provided', () => {
it('should log errors if errorHandler is NOT provided', () => {
const errorFunc = jest.fn().mockImplementation(() => {
throw Error('Exception');
});
expect(() => {
CronJob.from({
cronTime: '* * * * * *',
onTick: errorFunc,
runOnInit: true
});
}).toThrow('Exception');
console.error = jest.fn();
CronJob.from({
cronTime: '* * * * * *',
onTick: errorFunc,
runOnInit: true
});
expect(console.error).toHaveBeenCalled();
});

describe('waitForCompletion and job status tracking', () => {
Expand Down

0 comments on commit 21cb4a6

Please sign in to comment.