-
-
Notifications
You must be signed in to change notification settings - Fork 538
Expand file tree
/
Copy pathtranslateGlossary.spec.js
More file actions
32 lines (30 loc) · 1.1 KB
/
translateGlossary.spec.js
File metadata and controls
32 lines (30 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const TextLintTester = require('textlint-tester').default;
const data = require('../../data/rules/translateGlossary');
const rule = require('../../rules/translateGlossary');
const {errMsgTranslateGlossary} = require('../../utils/errMsg');
const tester = new TextLintTester();
describe('translateGlossary', function () {
Object.values(data).forEach((type1) => {
Object.values(type1).forEach((type2) => {
type2.forEach(({target, meta}) => {
tester.run(`term: ${meta.term}`, rule, {
invalid: [
{
text: `한글이 포함된 Str node. ${meta.term} 가나다 abc.`,
errors: [
{
message: errMsgTranslateGlossary(meta.term, target),
},
],
},
],
valid: [
`한글이 포함된 Str node. "${meta.term}" 라마바 def.`, // stripDoubleQuotes func should be applied.
`한글이 포함된 Str node. (${meta.term}) 사아자 ghi.`, // stripParentheses func should be applied.
target,
],
});
});
});
});
});