test: add test case for en-US blog to avoid omission in translation (#40231)

This commit is contained in:
lijianan 2023-01-14 19:30:26 +08:00 committed by GitHub
parent df3c33c378
commit 973abb6e56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,27 @@
const fs = require('fs');
const path = require('path');
const blogList = [
'check-conduct',
'css-in-js',
'getContainer',
'modal-hook-order',
'render-times',
'testing-migrate',
'to-be-collaborator',
].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);
});
});
});
});