Skip to content

Commit

Permalink
Fix tests after rebase (new i18nProvider)
Browse files Browse the repository at this point in the history
  • Loading branch information
djhi committed Sep 13, 2019
1 parent 95b2771 commit 3a0818d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/ra-core/src/form/useChoices.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import expect from 'expect';
import { render, cleanup } from '@testing-library/react';
import useChoices from './useChoices';
import { renderWithRedux } from '../util';
import { TranslationProvider } from '../i18n';
import { TestTranslationProvider } from '../i18n';

describe('useChoices hook', () => {
afterEach(cleanup);
Expand Down Expand Up @@ -70,21 +70,21 @@ describe('useChoices hook', () => {

it('should translate the choice by default', () => {
const { queryAllByText } = renderWithRedux(
<TranslationProvider i18nProvider={() => ({ test: 'bonjour' })}>
<TestTranslationProvider translate={x => `**${x}**`}>
<Component {...defaultProps} />
</TranslationProvider>
</TestTranslationProvider>
);
expect(queryAllByText('test')).toHaveLength(0);
expect(queryAllByText('bonjour')).toHaveLength(1);
expect(queryAllByText('**test**')).toHaveLength(1);
});

it('should not translate the choice if translateChoice is false', () => {
const { queryAllByText } = renderWithRedux(
<TranslationProvider i18nProvider={() => ({ hello: 'bonjour' })}>
<TestTranslationProvider translate={x => `**${x}**`}>
<Component {...defaultProps} translateChoice={false} />
</TranslationProvider>
</TestTranslationProvider>
);
expect(queryAllByText('test')).toHaveLength(1);
expect(queryAllByText('bonjour')).toHaveLength(0);
expect(queryAllByText('**test**')).toHaveLength(0);
});
});

0 comments on commit 3a0818d

Please sign in to comment.