Commit f688762e authored by Kev's avatar Kev

Add jest test to parseHeaderLine

parent 656f5f4d
......@@ -17,7 +17,7 @@ export const parseLine = (line = {}, lineNumber) => ({
* @param Number lineNumber
*/
export const parseHeaderLine = (line = {}, lineNumber) => ({
isClosed: line.section_options ? line.section_options.collapsed === 'true' : false,
isClosed: line.section_options?.collapsed === 'true',
isHeader: true,
line: parseLine(line, lineNumber),
lines: [],
......
......@@ -35,6 +35,14 @@ describe('Jobs Store Utils', () => {
lines: [],
});
});
it('pre-closes a section when specified in options', () => {
const headerLine = { content: [{ text: 'foo' }], section_options: { collapsed: 'true' } };
const parsedHeaderLine = parseHeaderLine(headerLine, 2);
expect(parsedHeaderLine.isClosed).toBe(true);
});
});
describe('parseLine', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment