All files / tests/shared rtlTest.tsx

75% Statements 6/8
50% Branches 2/4
100% Functions 3/3
75% Lines 6/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26                2x 2x 2x     2x         2x 2x            
import React from 'react';
import Moment from 'moment';
import MockDate from 'mockdate';
import {mount} from 'enzyme';
import {ConfigProvider} from 'antd';
 
// eslint-disable-next-line jest/no-export
export default function rtlTest(Component: React.ComponentType, mockDate?: boolean) {
  describe(`rtl render`, () => {
    it(`component should be rendered correctly in RTL direction`, () => {
      Iif (mockDate) {
        MockDate.set(Moment('2000-09-28').valueOf());
      }
      const wrapper = mount(
        <ConfigProvider direction="rtl">
          <Component />
        </ConfigProvider>
      );
      expect(wrapper).toMatchSnapshot();
      Iif (mockDate) {
        MockDate.reset();
      }
    });
  });
}