ant-design/components/__tests__/blog.test.ts

36 lines
875 B
TypeScript
Raw Normal View History

const fs = require('fs');
const path = require('path');
const blogList = [
'check-conduct',
2023-07-05 17:47:58 +08:00
'contributor-development-maintenance-guide',
'css-in-js',
2023-07-05 17:47:58 +08:00
'extract-ssr',
'getContainer',
2023-07-05 17:47:58 +08:00
'github-actions-workflow',
'issue-helper',
'mock-project-build',
'modal-hook-order',
'testing-migrate',
2023-07-05 17:47:58 +08:00
'render-times',
'to-be-collaborator',
2023-07-05 17:47:58 +08:00
'tooltip-align',
'tree-shaking',
'why-not-static',
].map((blogName) => path.join(__dirname, `../../docs/blog/${blogName}.en-US.md`));
describe('blog', () => {
it('should not include Chinese in en-US blog', () => {
blogList.forEach((blog) => {
fs.readFile(blog, (err: NodeJS.ErrnoException | null, data: Buffer) => {
if (err) {
return;
}
const includeChinese = /[\u4E00-\u9FA5]/.test(data.toString());
expect(includeChinese).toBe(false);
});
});
});
});