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', () => {
|
|
|
|
const parser = new YamlParser();
|
|
|
|
const data = parser.dump({}, {});
|
|
|
|
|
|
|
|
expect(data).to.contain('---');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('parse documents', () => {
|
|
|
|
it('should parse multiple documents', () => {
|
|
|
|
const parser = new YamlParser();
|
|
|
|
const data = parser.parse(`
|
|
|
|
foo: {}
|
|
|
|
---
|
|
|
|
bar: {}
|
|
|
|
`);
|
|
|
|
|
|
|
|
expect(Array.isArray(data)).to.equal(true);
|
|
|
|
expect(data.length).to.equal(2);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|