Updated pie parsing with the new syntax + fix for flowDb

This commit is contained in:
Knut Sveidqvist
2022-04-30 15:13:28 +02:00
parent 8372d4952e
commit a401e44180
4 changed files with 51 additions and 45 deletions

View File

@@ -62,7 +62,7 @@ pie
expect(title).toBe('a 60/40 pie');
});
it('should handle simple pie without an acc description', function () {
it('should handle simple pie without an acc description (accDescr)', function () {
const res = pie.parser.parse(`pie title a neat chart
"ash" : 60
"bat" : 40
@@ -77,9 +77,9 @@ pie
expect(description).toBe('');
});
it('should handle simple pie with an acc description', function () {
it('should handle simple pie with an acc description (accDescr)', function () {
const res = pie.parser.parse(`pie title a neat chart
accDescription a neat description
accDescr: a neat description
"ash" : 60
"bat" : 40
`);
@@ -92,6 +92,24 @@ pie
expect(title).toBe('a neat chart');
expect(description).toBe('a neat description');
});
it('should handle simple pie with a multiline acc description (accDescr)', function () {
const res = pie.parser.parse(`pie title a neat chart
accDescr {
a neat description
on multiple lines
}
"ash" : 60
"bat" : 40
`);
const sections = pieDb.getSections();
const title = pieDb.getTitle();
const description = pieDb.getAccDescription();
const section1 = sections['ash'];
expect(section1).toBe(60);
expect(title).toBe('a neat chart');
expect(description).toBe('a neat description\non multiple lines');
});
it('should handle simple pie with positive decimal', function () {
const res = pie.parser.parse(`pie