Skip to content

Commit

Permalink
Fix the type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aniketkatkar97 committed Oct 15, 2024
1 parent 50ffaed commit 338c73f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ const CronEditor = ({
t('message.cron-less-than-hour-message')
);
}
Promise.resolve();

return Promise.resolve();
},
},
]}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,89 +12,7 @@
*/

import { AppType } from '../generated/entity/applications/app';
import { getCronInitialValue, getQuartzCronExpression } from './CronUtils';

describe('getQuartzCronExpression function', () => {
it('should generate cron expression for every minute', () => {
const state = {
selectedPeriod: 'minute',
selectedMinOption: { min: 1 },
selectedHourOption: { min: 0 },
selectedDayOption: { min: 0, hour: 0 },
selectedWeekOption: { min: 0, hour: 0, dow: 0 },
selectedMonthOption: { min: 0, hour: 0, dom: 1 },
selectedYearOption: { min: 0, hour: 0, dom: 1, mon: 1 },
};

const result = getQuartzCronExpression(state);

expect(result).toEqual('0 0/1 * * * ?');
});

it('should generate cron expression for every hour', () => {
const state = {
selectedPeriod: 'hour',
selectedMinOption: { min: 0 },
selectedHourOption: { min: 0 },
selectedDayOption: { min: 0, hour: 0 },
selectedWeekOption: { min: 0, hour: 0, dow: 0 },
selectedMonthOption: { min: 0, hour: 0, dom: 1 },
selectedYearOption: { min: 0, hour: 0, dom: 1, mon: 1 },
};

const result = getQuartzCronExpression(state);

expect(result).toEqual('0 0 * * * ?');
});

it('should generate cron expression for specific time on a specific day of the month and month of the year', () => {
const state = {
selectedPeriod: 'year',
selectedMinOption: { min: 0 },
selectedHourOption: { min: 0 },
selectedDayOption: { min: 0, hour: 0 },
selectedWeekOption: { min: 0, hour: 0, dow: 0 },
selectedMonthOption: { min: 0, hour: 0, dom: 0 },
selectedYearOption: { min: 45, hour: 3, dom: 1, mon: 7 },
};

const result = getQuartzCronExpression(state);

expect(result).toEqual('0 45 3 1 7 ?');
});

it('should generate cron expression for specific time daily', () => {
const state = {
selectedPeriod: 'day',
selectedMinOption: { min: 0 },
selectedHourOption: { min: 0 },
selectedDayOption: { min: 15, hour: 8 },
selectedWeekOption: { min: 0, hour: 0, dow: 0 },
selectedMonthOption: { min: 0, hour: 0, dom: 0 },
selectedYearOption: { min: 45, hour: 3, dom: 1, mon: 7 },
};

const result = getQuartzCronExpression(state);

expect(result).toEqual('0 15 8 * * ?');
});

it('should generate cron expression for specific time on a specific day of the week', () => {
const state = {
selectedPeriod: 'week',
selectedMinOption: { min: 0 },
selectedHourOption: { min: 0 },
selectedDayOption: { min: 15, hour: 8 },
selectedWeekOption: { min: 30, hour: 10, dow: 3 },
selectedMonthOption: { min: 0, hour: 0, dom: 0 },
selectedYearOption: { min: 45, hour: 3, dom: 1, mon: 7 },
};

const result = getQuartzCronExpression(state);

expect(result).toEqual('0 30 10 ? * 4');
});
});
import { getCronInitialValue } from './CronUtils';

describe('getCronInitialValue function', () => {
it('should generate hour cron expression if appType is internal and appName is not DataInsightsReportApplication', () => {
Expand Down

0 comments on commit 338c73f

Please sign in to comment.