Skip to content

Commit

Permalink
test(react-crud): make locale test environment-independant
Browse files Browse the repository at this point in the history
  • Loading branch information
platosha committed Dec 3, 2024
1 parent 8882622 commit 433cce2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/ts/react-crud/test/locale.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from '@esm-bundle/chai';
import { render } from '@testing-library/react';
import type { DatePickerDate } from '@vaadin/react-components/DatePicker.js';
import { LocaleFormatter, useDatePickerI18n } from '../src/locale.js';
import { LocaleContext, LocaleFormatter, useDatePickerI18n } from '../src/locale.js';

describe('@vaadin/hilla-react-crud', () => {
describe('LocaleFormatter', () => {
Expand Down Expand Up @@ -89,7 +89,11 @@ describe('@vaadin/hilla-react-crud', () => {
}

it('uses "formatDate" and "parse" correctly', () => {
const { getByText } = render(<I18nTestComponent />);
const { getByText } = render(
<LocaleContext.Provider value={'en-US'}>
<I18nTestComponent />
</LocaleContext.Provider>,
);
expect(getByText(dateAsString)).to.exist;
const json = JSON.stringify(dateAsObject);
expect(getByText(json)).to.exist;
Expand Down

0 comments on commit 433cce2

Please sign in to comment.