File size: 847 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
27
28
29
30
31
32
33
import { version } from 'react';

import { waitFakeTimer19 } from '../../../tests/utils';
import Modal from '../../modal';

jest.mock('rc-util/lib/Dom/isVisible', () => () => true);

describe('UnstableContext', () => {
  beforeEach(() => {
    jest.useFakeTimers();
  });

  afterEach(() => {
    jest.useRealTimers();
  });

  // TODO: Remove in v6
  it('should warning', async () => {
    const majorVersion = parseInt(version.split('.')[0], 10);

    if (majorVersion >= 19) {
      const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
      Modal.info({ title: 'title', content: 'content' });

      await waitFakeTimer19();

      expect(errorSpy).toHaveBeenCalledWith(
        'Warning: [antd: compatible] antd v5 support React is 16 ~ 18. see https://u.ant.design/v5-for-19 for compatible.',
      );
    }
  });
});