import { render } from '../../test-utils';

import { LanguageProvider } from '.';

describe('LanguageProvider', () => {
  beforeEach(() => {
    document.documentElement.removeAttribute('lang');
  });

  it.each([['en'], ['ru'], ['ja']])('store language %s in React Context', (locale: string) => {
    const TestComponent = () => {
      return <>locale: {locale}</>;
    };
    const { container } = render(
      <LanguageProvider locale={locale}>
        <TestComponent />
      </LanguageProvider>,
    );

    expect(container).toHaveTextContent(`locale: ${locale}`);
  });
});
