import { expect } from 'chai'; import { DictEntry } from './dict-entry'; import { gatherFromMarkdownFiles, isTranslation } from './extractor'; describe('auto check translations', function () { const entries = gatherFromMarkdownFiles(__dirname + '/../'); it('should not have in translation', function () { const codeExamples = entries.filter(entry => entry.translation.indexOf(' isTranslation(entry.original)) .filter(isNotImg) .filter(isNotCheatSheet) .filter(isNotMarketingDocs) .filter(isNotCnPages); expect(lines).eql([]); }); }); function isNotImg(entry: DictEntry): boolean { return !/^<(img|figure)/.test(entry.translation); } function isNotCheatSheet(entry: DictEntry): boolean { return !/cheatsheet.md$/.test(entry.sourceFile); } function isNotMarketingDocs(entry: DictEntry): boolean { return !/marketing\/docs.md$/.test(entry.sourceFile); } function isNotCnPages(entry: DictEntry): boolean { return !/cn\/.*?.md$/.test(entry.sourceFile); }