Skip to content

Commit

Permalink
test: increase timer values in scheduler integration test (#3448)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew committed Apr 4, 2023
1 parent d65a357 commit c16fde5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/lib/services/scheduler-service.test.ts
Expand Up @@ -5,7 +5,7 @@ function ms(timeMs) {
}

const getLogger = () => {
const records = [];
const records: any[] = [];
const logger = () => ({
error(...args: any[]) {
records.push(args);
Expand Down Expand Up @@ -37,8 +37,8 @@ test('Can schedule a single regular job', async () => {
const schedulerService = new SchedulerService(getLogger());
const job = jest.fn();

schedulerService.schedule(job, 10);
await ms(15);
schedulerService.schedule(job, 50);
await ms(75);

expect(job).toBeCalledTimes(2);
schedulerService.stop();
Expand All @@ -49,9 +49,9 @@ test('Can schedule multiple jobs at the same interval', async () => {
const job = jest.fn();
const anotherJob = jest.fn();

schedulerService.schedule(job, 10);
schedulerService.schedule(anotherJob, 10);
await ms(15);
schedulerService.schedule(job, 50);
schedulerService.schedule(anotherJob, 50);
await ms(75);

expect(job).toBeCalledTimes(2);
expect(anotherJob).toBeCalledTimes(2);
Expand Down Expand Up @@ -79,8 +79,8 @@ test('Can handle crash of a async job', async () => {
await Promise.reject('async reason');
};

schedulerService.schedule(job, 10);
await ms(15);
schedulerService.schedule(job, 50);
await ms(75);

schedulerService.stop();
expect(logger.getRecords()).toEqual([
Expand All @@ -96,8 +96,8 @@ test('Can handle crash of a sync job', async () => {
throw new Error('sync reason');
};

schedulerService.schedule(job, 10);
await ms(15);
schedulerService.schedule(job, 50);
await ms(75);

schedulerService.stop();
expect(logger.getRecords()).toEqual([
Expand Down

0 comments on commit c16fde5

Please sign in to comment.