add showData unit test case

This commit is contained in:
Yokozuna59 2023-06-19 17:52:28 +03:00
parent 35c6b671de
commit cecf759b0b

View File

@ -34,6 +34,19 @@ describe('pie chart', () => {
expect(sections['bat']).toBe(40);
});
it('should handle simple pie with showData', () => {
parser.parse(`pie showData
"ash" : 60
"bat" : 40
`);
expect(db.getShowData()).toBeTruthy();
const sections = db.getSections();
expect(sections['ash']).toBe(60);
expect(sections['bat']).toBe(40);
});
it('should handle simple pie with comments', () => {
parser.parse(`pie
%% comments
@ -161,9 +174,9 @@ describe('pie chart', () => {
});
it('reset', () => {
db.setConfig({ useWidth: 850 });
db.setConfig({ textPosition: 0 });
db.reset();
expect(db.getConfig().useWidth).toStrictEqual(DEFAULT_PIE_DB.config.useWidth);
expect(db.getConfig().textPosition).toStrictEqual(DEFAULT_PIE_DB.config.textPosition);
});
});
});