mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01: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 records = [];
|
||||
const records: any[] = [];
|
||||
const logger = () => ({
|
||||
error(...args: any[]) {
|
||||
records.push(args);
|
||||
@ -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();
|
||||
@ -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);
|
||||
@ -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([
|
||||
@ -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([
|
||||
|
Loading…
Reference in New Issue
Block a user