1
0
Fork 0
salty-dog/test/parser/TestYamlParser.ts

30 lines
684 B
TypeScript
Raw Normal View History

2019-07-02 03:32:21 +00:00
import { expect } from 'chai';
2019-08-30 05:24:12 +00:00
import { YamlParser } from '../../src/parser/YamlParser';
2019-07-02 03:32:21 +00:00
describe('yaml parser', () => {
describe('dump documents', () => {
it('should dump multiple documents', () => {
2019-09-11 13:48:14 +00:00
const parser = new YamlParser();
const data = parser.dump({}, {});
2019-07-02 03:32:21 +00:00
2019-09-11 13:48:14 +00:00
expect(data).to.contain('---');
2019-07-02 03:32:21 +00:00
});
});
describe('parse documents', () => {
it('should parse multiple documents', () => {
const parser = new YamlParser();
const data = parser.parse(`
foo: {}
---
bar: {}
`);
2019-09-11 13:48:14 +00:00
2019-07-02 03:32:21 +00:00
expect(Array.isArray(data)).to.equal(true);
2019-11-19 12:03:48 +00:00
const EXPECTED_DOCS = 2;
expect(data.length).to.equal(EXPECTED_DOCS);
2019-07-02 03:32:21 +00:00
});
});
});