Skip to content

Commit

Permalink
Update tests to support export indentation toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
charl botha authored and cpbotha committed Apr 6, 2020
1 parent c1807f7 commit 2ce599b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/components/OrgFile/OrgFile.unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ function parseAndExportOrgFile(testOrgFile) {
const todoKeywordSets = parsedFile.get('todoKeywordSets');
const fileConfigLines = parsedFile.get('fileConfigLines');
const linesBeforeHeadings = parsedFile.get('linesBeforeHeadings');
const exportedFile = exportOrg(headers, todoKeywordSets, fileConfigLines, linesBeforeHeadings);
// we keep the default behaviour of indenting the element body according to nesting depth
const exportedFile = exportOrg(
headers, todoKeywordSets, fileConfigLines, linesBeforeHeadings, false);
return exportedFile;
}

Expand All @@ -40,25 +42,25 @@ describe('Tests for export', () => {
test('Simple description export of empty description works', () => {
const description = '';
const header = createSimpleHeaderWithDescription(description);
expect(createRawDescriptionText(header, false)).toEqual(description);
expect(createRawDescriptionText(header, false, false)).toEqual(description);
});

test('Simple description export of empty line works', () => {
const description = '\n';
const header = createSimpleHeaderWithDescription(description);
expect(createRawDescriptionText(header, false)).toEqual(description);
expect(createRawDescriptionText(header, false, false)).toEqual(description);
});

test('Simple description export of non-empty line works', () => {
const description = 'abc\n';
const header = createSimpleHeaderWithDescription(description);
expect(createRawDescriptionText(header, false)).toEqual(description);
expect(createRawDescriptionText(header, false, false)).toEqual(description);
});

test('Simple description export of non-empty line without trailing newline works (newline will be added)', () => {
const description = 'abc';
const header = createSimpleHeaderWithDescription(description);
expect(createRawDescriptionText(header, false)).toEqual(`${description}\n`);
expect(createRawDescriptionText(header, false, false)).toEqual(`${description}\n`);
});
});

Expand Down
3 changes: 2 additions & 1 deletion src/lib/parse_org.unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ function parseAndExportOrgFile(testOrgFile) {
const todoKeywordSets = parsedFile.get('todoKeywordSets');
const fileConfigLines = parsedFile.get('fileConfigLines');
const linesBeforeHeadings = parsedFile.get('linesBeforeHeadings');
const exportedFile = exportOrg(headers, todoKeywordSets, fileConfigLines, linesBeforeHeadings);
const exportedFile = exportOrg(
headers, todoKeywordSets, fileConfigLines, linesBeforeHeadings, false);
return exportedFile;
}

Expand Down

0 comments on commit 2ce599b

Please sign in to comment.