import React from 'react'; import { render } from '@testing-library/react'; import { Options, Basic, NoTranslation, NoTranslationWithChildrenAsNode, NoTranslationWithChildrenAsString, ReactElementInterpolation, } from './Translate.stories'; describe('', () => { it('should render the translation', () => { const { container } = render(); expect(container.innerHTML).toBe('My Translated Key'); }); it('should render the translation event if children is set', () => { const { container } = render( ); expect(container.innerHTML).toBe('My Translated Key'); }); it('should render anything if no translation available', () => { const { container } = render(); expect(container.innerHTML).toBe(''); }); it('should render the children (string) if no translation available', () => { const { container } = render(); expect(container.innerHTML).toBe('My Default Translation'); }); it('should render the children (ReactNode) if no translation available', () => { const { container } = render(); expect(container.innerHTML).toBe( '
My Default Translation
' ); }); it('should render the translation with options', () => { const { container } = render(); expect(container.innerHTML).toBe('It cost 6.00 $'); }); it('should render the translation with React element interpolation', () => { const { container } = render(); expect(container.innerHTML).toBe( 'Hello John, welcome to react-admin!' ); }); });