-
Notifications
You must be signed in to change notification settings - Fork 21
/
language.spec.ts
37 lines (19 loc) · 889 Bytes
/
language.spec.ts
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
33
34
35
36
37
/* eslint-disable max-len */
import { sm } from '../jssm';
const glob = require('glob'),
language_files = glob.sync('./src/ts/tests/language_data/*.json', {}) // for some reason glob is project-relative
.map(rel => rel.replace('/src/ts/tests', '')); // instead of execution relative like i'd expect
describe('base data walk/1', () => {
language_files.map( (language_file, i) => {
const testData = require(language_file),
testTokens = testData.cases;
const foreignTarget = sm`${testData.native_name} -> ${testData.english_name} -> ${testTokens.join(' -> ')};`;
describe(`language ${i} "${testData.english_name}" contains all states`, () => {
testTokens.map(tok =>
test(tok, () =>
expect( foreignTarget.states().includes(tok) ).toBe(true)
)
);
});
});
});