| Marc Kupietz | b43a518 | 2024-02-03 18:09:10 +0100 | [diff] [blame^] | 1 | const { execSync } = require('child_process'); |
| 2 | const exp = require('constants'); |
| 3 | |
| 4 | describe('conllu2cmc', () => { |
| 5 | test('Test sparse mode', (done) => { |
| 6 | // Modify the command based on your script's location and options |
| 7 | const command = 'node src/index.js -s < test/data/ndy.conllu'; |
| 8 | const stdout = execSync(command).toString(); |
| 9 | expect(stdout).toContain('😂\t_\tEMOIMG\tEMOIMG'); |
| 10 | var emoimg_count = (stdout.match(/EMOIMG/g) || []).length; |
| 11 | expect(emoimg_count).toBe(382); |
| 12 | var ascimg_count = (stdout.match(/EMOASC/g) || []).length; |
| 13 | expect(ascimg_count).toBe(60); |
| 14 | var ascimg_count = (stdout.match(/URL/g) || []).length; |
| 15 | expect(ascimg_count).toBe(8); |
| 16 | var adr_count = (stdout.match(/ADR/g) || []).length; |
| 17 | expect(adr_count).toBe(2); |
| 18 | var lines_count = (stdout.split("\n")).length; |
| 19 | expect(lines_count).toBe(744); |
| 20 | done(); |
| 21 | }); |
| 22 | |
| 23 | test('Test full mode', (done) => { |
| 24 | const command = 'node src/index.js < test/data/ndy.conllu'; |
| 25 | const stdout = execSync(command).toString(); |
| 26 | expect(stdout).toContain('😂\t_\tEMOIMG\tEMOIMG'); |
| 27 | var emoimg_count = (stdout.match(/EMOIMG/g) || []).length; |
| 28 | expect(emoimg_count).toBe(382); |
| 29 | var ascimg_count = (stdout.match(/EMOASC/g) || []).length; |
| 30 | expect(ascimg_count).toBe(60); |
| 31 | var ascimg_count = (stdout.match(/URL/g) || []).length; |
| 32 | expect(ascimg_count).toBe(8); |
| 33 | var adr_count = (stdout.match(/ADR/g) || []).length; |
| 34 | expect(adr_count).toBe(2); |
| 35 | var lines_count = (stdout.split("\n")).length; |
| 36 | expect(lines_count).toBe(6200); |
| 37 | done(); |
| 38 | }); |
| 39 | }); |