mirror of
https://github.com/documentationjs/documentation.git
synced 2026-01-25 14:26:29 +00:00
24 lines
619 B
JavaScript
24 lines
619 B
JavaScript
const fs = require('fs');
|
|
const {
|
|
commentToFlow,
|
|
parseToAst
|
|
} = require('../../../src/parsers/parse_to_ast');
|
|
|
|
describe('flow comments', () => {
|
|
const f = require.resolve('../../fixture/flow/comment-types');
|
|
const src = fs.readFileSync(f, 'utf8');
|
|
|
|
test('preserve line numbers', () => {
|
|
const out = commentToFlow(src);
|
|
const linesSrc = src.split(/\n/);
|
|
const linesOut = out.split(/\n/);
|
|
|
|
expect(linesOut).toHaveLength(linesSrc.length);
|
|
expect(linesSrc[14]).toEqual(linesOut[14]);
|
|
});
|
|
|
|
test('valid js', () => {
|
|
expect(() => parseToAst(src, 'test.js')).not.toThrowError();
|
|
});
|
|
});
|