Automatically test parsing of all the .otto examples in the examples/ directory

This commit is contained in:
R Tyler Croy 2019-07-07 09:00:31 -07:00
parent 9f6a9f792a
commit 42a10e3b9b
No known key found for this signature in database
GPG Key ID: E5C92681BEF6CEA2
2 changed files with 13 additions and 0 deletions

View File

@ -2,10 +2,23 @@
* This test file will verify the parsing behavior of the pipeline block
*/
import fs from 'fs';
import path from 'path';
import { MIN_PIPELINE, parse } from '../utils';
describe('pipeline {}', () => {
it('should pass with the minimum viable pipeline', () => {
expect(parse(MIN_PIPELINE)).toHaveLength(0);
});
describe('with full examples', () => {
const examples_dir = path.join(__dirname, '..', '..', 'examples');
fs.readdirSync(examples_dir).filter(filename => filename.endsWith('.otto')).map((filename) => {
it(`should be able to parse ${filename}`, () => {
const buffer = fs.readFileSync(path.join(examples_dir, filename), 'utf8');
expect(parse(buffer)).toHaveLength(0);
});
});
});
});