2018-05-25 14:54:16 +08:00
|
|
|
const OLD_NODE_ENV = process.env.NODE_ENV;
|
|
|
|
process.env.NODE_ENV = 'development';
|
2018-03-26 15:36:44 +08:00
|
|
|
const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
|
|
|
|
const antd = require('..');
|
2017-01-08 17:04:09 +08:00
|
|
|
|
|
|
|
describe('antd', () => {
|
2018-05-25 14:54:16 +08:00
|
|
|
afterAll(() => {
|
|
|
|
process.env.NODE_ENV = OLD_NODE_ENV;
|
|
|
|
});
|
|
|
|
|
2017-01-08 17:04:09 +08:00
|
|
|
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).toBeCalledWith(
|
2018-12-07 20:02:01 +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();
|
|
|
|
});
|
2017-01-08 17:04:09 +08:00
|
|
|
});
|