blob: 6673fb2e83bd76eb7ef085a727b4b82c73f82672 (
plain)
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
|
const fs = require('fs');
const path = require('path');
const expect = require('expect');
const langs = require('../src').langs;
describe('Languages parsing', () => {
let LEXED;
before(() => {
const CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/LANGS.adoc'), 'utf8');
LEXED = langs(CONTENT);
});
it('should detect paths and titles', () => {
expect(LEXED[0].ref).toBe('en/');
expect(LEXED[0].title,'English');
expect(LEXED[1].ref).toBe('fr/');
expect(LEXED[1].title).toBe('French');
});
it('should correctly convert it to text', () => {
const text = langs.toText(LEXED);
const parsed = langs(text);
expect(parsed).toEqual(LEXED);
});
});
|