Skip to content

Commit

Permalink
Update testing-library layer for new locale system
Browse files Browse the repository at this point in the history
  • Loading branch information
NuckChorris committed Jan 2, 2025
1 parent 9ef13e6 commit 7a3d014
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/test-utils/testing-library.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
/* eslint-disable i18next/no-literal-string */

import '@testing-library/jest-dom/vitest';

import {
render as _render,
cleanup,
RenderOptions,
RenderResult,
type RenderOptions,
type RenderResult,
} from '@testing-library/react';
import React from 'react';
import { IntlProvider } from 'react-intl';
import { beforeEach } from 'vitest';

import { DateFnsLocaleContext, LocaleContext } from 'app/contexts/IntlContext';
import enUS from 'app/locales/headers/en-US';
import enUS from 'app/locales/bundles/en-US/header';

const localeData = await enUS.load();
const main = await enUS.bundles.main();

const Provider = function ({
children,
Expand All @@ -29,8 +27,8 @@ const Provider = function ({
setLocale: () => null,
unsetLocale: () => null,
}}>
<DateFnsLocaleContext.Provider value={localeData.dateFns}>
<IntlProvider locale="en-US" key="en-US" messages={localeData.kitsu}>
<DateFnsLocaleContext.Provider value={main.dateFns}>
<IntlProvider locale="en-US" key="en-US" messages={main.kitsu}>
{children}
</IntlProvider>
</DateFnsLocaleContext.Provider>
Expand Down

0 comments on commit 7a3d014

Please sign in to comment.