Skip to content

Commit

Permalink
Suppress error message for parser test (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamos-tay authored and yamgent committed Jan 13, 2019
1 parent aafb2b7 commit afb2746
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/unit/parser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ test('includeFile replaces <include src="include.md#doesNotExist"> with error <d

const include = ['# Include'].join('\n');

const expectedErrorMessage = `No such segment 'doesNotExist' in file: ${includePath}`
+ `\nMissing reference in ${indexPath}`;

const json = {
'index.md': index,
'include.md': include,
Expand All @@ -192,7 +195,11 @@ test('includeFile replaces <include src="include.md#doesNotExist"> with error <d
const baseUrlMap = {};
baseUrlMap[ROOT_PATH] = true;

const markbinder = new MarkBind();
const markbinder = new MarkBind({
errorHandler: (e) => {
expect(e.message).toEqual(expectedErrorMessage);
},
});
const result = await markbinder.includeFile(indexPath, {
baseUrlMap,
rootPath: ROOT_PATH,
Expand All @@ -201,8 +208,7 @@ test('includeFile replaces <include src="include.md#doesNotExist"> with error <d

const expected = [
'# Index',
`<div style="color: red">No such segment 'doesNotExist' in file: ${includePath}`,
`Missing reference in ${indexPath}</div>`,
`<div style="color: red">${expectedErrorMessage}</div>`,
'',
].join('\n');

Expand Down

0 comments on commit afb2746

Please sign in to comment.