import { mount } from 'enzyme'; import React from 'react'; import { ConfigProvider } from 'antd'; import ProTable from '@ant-design/pro-table'; import { request } from './demo'; import { waitForComponentToPaint } from '../util'; import moment from 'moment'; describe('Table ColumnSetting', () => { it('🎏 render', async () => { const callBack = jest.fn(); const html = mount( callBack(text), }, ]} request={request} rowKey="key" />, ); await waitForComponentToPaint(html, 1200); expect(callBack).toBeCalled(); expect(callBack).toBeCalledWith('Edward King 0'); }); it('🎏 query should parse by valueType', async () => { const callBack = jest.fn(); const html = mount( { console.log(params); callBack(params.date); return { data: [ { key: '1', date: moment(), }, ], success: true, }; }} rowKey="key" />, ); await waitForComponentToPaint(html, 1000); expect(callBack).toBeCalled(); expect(callBack).toBeCalledWith('2016-11-22'); }); it('🎏 config provide render', async () => { const html = mount( , ); await waitForComponentToPaint(html, 1200); expect(html.render()).toMatchSnapshot(); }); it('🎏 render text', async () => { const callBack = jest.fn(); const html = mount( callBack(text), }, { title: 'Name2', key: 'name2', dataIndex: 'name2', valueType: false, }, ]} request={request} rowKey="key" />, ); await waitForComponentToPaint(html, 1200); expect(callBack).toBeCalled(); expect(callBack).toBeCalledWith('Edward King 0'); }); it('🎏 change text by renderText', async () => { const html = mount( `${text}2144`, }, ]} search={false} request={request} rowKey="key" />, ); await waitForComponentToPaint(html, 1200); expect(html.find('td.ant-table-cell')).toMatchSnapshot(); }); });