mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-04 01:18:20 +02:00
test: increase timer values in scheduler integration test (#3448)
This commit is contained in:
parent
d65a357a69
commit
c16fde5ab4
@ -5,7 +5,7 @@ function ms(timeMs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getLogger = () => {
|
const getLogger = () => {
|
||||||
const records = [];
|
const records: any[] = [];
|
||||||
const logger = () => ({
|
const logger = () => ({
|
||||||
error(...args: any[]) {
|
error(...args: any[]) {
|
||||||
records.push(args);
|
records.push(args);
|
||||||
@ -37,8 +37,8 @@ test('Can schedule a single regular job', async () => {
|
|||||||
const schedulerService = new SchedulerService(getLogger());
|
const schedulerService = new SchedulerService(getLogger());
|
||||||
const job = jest.fn();
|
const job = jest.fn();
|
||||||
|
|
||||||
schedulerService.schedule(job, 10);
|
schedulerService.schedule(job, 50);
|
||||||
await ms(15);
|
await ms(75);
|
||||||
|
|
||||||
expect(job).toBeCalledTimes(2);
|
expect(job).toBeCalledTimes(2);
|
||||||
schedulerService.stop();
|
schedulerService.stop();
|
||||||
@ -49,9 +49,9 @@ test('Can schedule multiple jobs at the same interval', async () => {
|
|||||||
const job = jest.fn();
|
const job = jest.fn();
|
||||||
const anotherJob = jest.fn();
|
const anotherJob = jest.fn();
|
||||||
|
|
||||||
schedulerService.schedule(job, 10);
|
schedulerService.schedule(job, 50);
|
||||||
schedulerService.schedule(anotherJob, 10);
|
schedulerService.schedule(anotherJob, 50);
|
||||||
await ms(15);
|
await ms(75);
|
||||||
|
|
||||||
expect(job).toBeCalledTimes(2);
|
expect(job).toBeCalledTimes(2);
|
||||||
expect(anotherJob).toBeCalledTimes(2);
|
expect(anotherJob).toBeCalledTimes(2);
|
||||||
@ -79,8 +79,8 @@ test('Can handle crash of a async job', async () => {
|
|||||||
await Promise.reject('async reason');
|
await Promise.reject('async reason');
|
||||||
};
|
};
|
||||||
|
|
||||||
schedulerService.schedule(job, 10);
|
schedulerService.schedule(job, 50);
|
||||||
await ms(15);
|
await ms(75);
|
||||||
|
|
||||||
schedulerService.stop();
|
schedulerService.stop();
|
||||||
expect(logger.getRecords()).toEqual([
|
expect(logger.getRecords()).toEqual([
|
||||||
@ -96,8 +96,8 @@ test('Can handle crash of a sync job', async () => {
|
|||||||
throw new Error('sync reason');
|
throw new Error('sync reason');
|
||||||
};
|
};
|
||||||
|
|
||||||
schedulerService.schedule(job, 10);
|
schedulerService.schedule(job, 50);
|
||||||
await ms(15);
|
await ms(75);
|
||||||
|
|
||||||
schedulerService.stop();
|
schedulerService.stop();
|
||||||
expect(logger.getRecords()).toEqual([
|
expect(logger.getRecords()).toEqual([
|
||||||
|
Loading…
Reference in New Issue
Block a user