Skip to content

Commit

Permalink
test: add tests for toFormatters
Browse files Browse the repository at this point in the history
  • Loading branch information
motss committed Sep 18, 2021
1 parent f16c64d commit e7b8179
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/tests/helpers/to-formatters.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { expect } from '@open-wc/testing';

import { toFormatters } from '../../helpers/to-formatters';
import type { Formatters } from '../../typings';

describe(toFormatters.name, () => {
it('returns formatters', () => {
const testLocale = 'en-US';
const result = toFormatters(testLocale);

expect(result).haveOwnProperty('locale', testLocale);

const props: (keyof Omit<Formatters, 'locale'>)[] = [
'dateFormat',
'dayFormat',
'fullDateFormat',
'longMonthFormat',
'longMonthYearFormat',
'longWeekdayFormat',
'narrowWeekdayFormat',
'yearFormat',
];

props.forEach(
n =>
expect(result).haveOwnProperty(n)
);
});
});

0 comments on commit e7b8179

Please sign in to comment.