ant-design/components/__tests__/index.test.js

22 lines
663 B
JavaScript
Raw Normal View History

2018-05-25 14:54:16 +08:00
const OLD_NODE_ENV = process.env.NODE_ENV;
process.env.NODE_ENV = 'development';
const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
const antd = require('..');
describe('antd', () => {
2018-05-25 14:54:16 +08:00
afterAll(() => {
process.env.NODE_ENV = OLD_NODE_ENV;
});
it('exports modules correctly', () => {
expect(Object.keys(antd)).toMatchSnapshot();
});
2018-05-25 14:54:16 +08:00
it('should hint when import all components in dev mode', () => {
expect(warnSpy).toHaveBeenCalledWith(
2018-12-07 16:17:45 +08:00
'You are using a whole package of antd, please use https://www.npmjs.com/package/babel-plugin-import to reduce app bundle size.',
2018-05-25 14:54:16 +08:00
);
warnSpy.mockRestore();
});
});