Skip to content

Commit

Permalink
fix test for schedules.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
lelemm committed Jan 22, 2025
1 parent 4167105 commit fba0507
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
49 changes: 49 additions & 0 deletions packages/loot-core/src/shared/schedules.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,55 @@ import MockDate from 'mockdate';

import * as monthUtils from './months';
import { getRecurringDescription, getStatus } from './schedules';

Check warning on line 5 in packages/loot-core/src/shared/schedules.test.ts

View workflow job for this annotation

GitHub Actions / lint

There should be at least one empty line between import groups
import i18next from 'i18next';

Check warning on line 6 in packages/loot-core/src/shared/schedules.test.ts

View workflow job for this annotation

GitHub Actions / lint

`i18next` import should occur before import of `mockdate`

i18next.init({
lng: 'en',
fallbackLng: 'en',
resources: {
en: {
translation: {
Every: 'Every',
day: 'day',
week: 'week',
month: 'month',
year: 'year',
on: 'on',
'on the': 'on the',
and: 'and',
'until {{date}}': 'until {{date}}',
once: 'once',
times: '{{endOccurrences}} times',
weekend: 'weekend',
last: 'last',
'Next:': 'Next:',
'last day': 'last day',
'{{interval}} days': '{{interval}} days',
'{{interval}} weeks': '{{interval}} weeks',
'{{interval}} months': '{{interval}} months',
'{{interval}} years': '{{interval}} years',

Sunday: 'Sunday',
Monday: 'Monday',
Tuesday: 'Tuesday',
Wednesday: 'Wednesday',
Thursday: 'Thursday',
Friday: 'Friday',
Saturday: 'Saturday',

'{{value}}th day': '{{value}}th day',
'{{value}}th': '{{value}}th',
'{{value}}th {{dayName}}': '{{value}}th {{dayName}}',
'last {{dayName}}': 'last {{dayName}}',

'({{weekendSolveMode}} weekend)': '({{weekendSolveMode}} weekend)',
},
},
},
interpolation: {
escapeValue: false,
},
});

describe('schedules', () => {
const today = new Date(2017, 0, 1); // Global date when testing is set to 2017-01-01 per monthUtils.currentDay()
Expand Down
2 changes: 1 addition & 1 deletion packages/loot-core/src/shared/schedules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function getRecurringDescription(config, dateFormat, locale: Locale) {
if (config.endOccurrences === 1) {
endModeSuffix = `, ${t('once')}`;
} else {
endModeSuffix = `, ${t('{{endOccurrences}} times', { endOccurences: config.endOccurrences })}`;
endModeSuffix = `, ${t('{{endOccurrences}} times', { endOccurrences: config.endOccurrences })}`;
}
break;
case 'on_date':
Expand Down

0 comments on commit fba0507

Please sign in to comment.