2019-01-12 03:33:27 +00:00
|
|
|
import pkg from '../package.json';
|
2018-05-13 15:11:51 +00:00
|
|
|
|
2019-01-12 03:33:27 +00:00
|
|
|
const testDist = process.env.LIB_DIR === 'dist';
|
2018-05-13 15:11:51 +00:00
|
|
|
|
|
|
|
describe('antd dist files', () => {
|
|
|
|
// https://github.com/ant-design/ant-design/issues/1638
|
|
|
|
// https://github.com/ant-design/ant-design/issues/1968
|
|
|
|
it('exports modules correctly', () => {
|
2019-01-12 03:33:27 +00:00
|
|
|
const antd = testDist ? require('../dist/antd') : require('../components'); // eslint-disable-line global-require
|
2021-12-24 08:45:10 +00:00
|
|
|
expect(
|
|
|
|
Object.keys(antd).map(key => {
|
|
|
|
if (antd[key].displayName) {
|
|
|
|
return `${key}: { displayName: ${antd[key].displayName} }`;
|
|
|
|
}
|
|
|
|
if (antd[key].name) {
|
|
|
|
return `${key}: { name: ${antd[key].name} }`;
|
|
|
|
}
|
|
|
|
return key;
|
|
|
|
}),
|
|
|
|
).toMatchSnapshot();
|
2019-01-12 03:33:27 +00:00
|
|
|
});
|
2018-05-13 15:11:51 +00:00
|
|
|
|
|
|
|
// https://github.com/ant-design/ant-design/issues/1970
|
|
|
|
// https://github.com/ant-design/ant-design/issues/1804
|
|
|
|
if (testDist) {
|
|
|
|
it('should have antd.version', () => {
|
2019-01-12 03:33:27 +00:00
|
|
|
const antd = require('../dist/antd'); // eslint-disable-line global-require
|
|
|
|
expect(antd.version).toBe(pkg.version);
|
|
|
|
});
|
2018-05-13 15:11:51 +00:00
|
|
|
}
|
2019-01-12 03:33:27 +00:00
|
|
|
});
|