|
1 | 1 | import { Script, translate } from '../src';
|
2 | 2 |
|
3 |
| -describe('baybayin', () => { |
4 |
| - describe('translate', () => { |
5 |
| - it('should return a string containing the baybayin text', () => { |
6 |
| - const text = 'a'; |
7 |
| - |
8 |
| - const result = translate(text); |
9 |
| - |
10 |
| - expect(result).toMatch('\u1700'); |
11 |
| - }); |
12 |
| - }); |
13 |
| -}); |
14 |
| - |
15 |
| -describe('hanunoo', () => { |
16 |
| - describe('translate', () => { |
17 |
| - it('should return a string containing the hanunoo text', () => { |
18 |
| - const text = 'a'; |
19 |
| - |
20 |
| - const result = translate(text, Script.HANUNOO); |
21 |
| - |
22 |
| - expect(result).toMatch('\u1720'); |
23 |
| - }); |
24 |
| - }); |
25 |
| -}); |
26 |
| - |
27 |
| -describe('buhid', () => { |
28 |
| - describe('translate', () => { |
29 |
| - it('should return a string containing the buhid text', () => { |
30 |
| - const text = 'nga'; |
31 |
| - |
32 |
| - const result = translate(text, Script.BUHID); |
33 |
| - |
34 |
| - expect(result).toMatch('\u1745'); |
35 |
| - }); |
36 |
| - }); |
37 |
| -}); |
38 |
| - |
39 |
| -describe('tagbanwa', () => { |
40 |
| - describe('translate', () => { |
41 |
| - it('should return a string containing the tagbanwa text', () => { |
42 |
| - const text = 'nga'; |
43 |
| - |
44 |
| - const result = translate(text, Script.TAGBANWA); |
45 |
| - |
46 |
| - expect(result).toMatch('\u1765'); |
47 |
| - }); |
| 3 | +const testCases = [ |
| 4 | + { script: Script.BAYBAYIN, text: 'a', expected: '\u1700' }, |
| 5 | + { script: Script.HANUNOO, text: 'a', expected: '\u1720' }, |
| 6 | + { script: Script.BUHID, text: 'nga', expected: '\u1745' }, |
| 7 | + { script: Script.TAGBANWA, text: 'nga', expected: '\u1765' }, |
| 8 | +]; |
| 9 | + |
| 10 | +testCases.forEach(({ script, text, expected }) => { |
| 11 | + test(`translate using script '${script}' with text '${text}' should return '${expected}'`, () => { |
| 12 | + const result = translate(text, script); |
| 13 | + expect(result).toMatch(expected); |
48 | 14 | });
|
49 | 15 | });
|
0 commit comments