Skip to content

Commit

Permalink
add excerpt length constant
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Mar 12, 2019
1 parent fd9dc21 commit b169e7b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/helpers/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const marked = require('../../');
const HtmlDiffer = require('@markedjs/html-differ').HtmlDiffer;
const htmlDiffer = new HtmlDiffer({ignoreSelfClosingSlash: true});

const EXCERPT_LENGTH = 30;

beforeEach(() => {
marked.setOptions(marked.getDefaults());

Expand All @@ -22,12 +24,12 @@ beforeEach(() => {
for (var i = 0; i < expectedHtml.length; i++) {
if (actualHtml[i] !== expectedHtml[i]) {
actualHtml = actualHtml.substring(
Math.max(i - 30, 0),
Math.min(i + 30, actualHtml.length));
Math.max(i - EXCERPT_LENGTH, 0),
Math.min(i + EXCERPT_LENGTH, actualHtml.length));

expectedHtml = expectedHtml.substring(
Math.max(i - 30, 0),
Math.min(i + 30, expectedHtml.length));
Math.max(i - EXCERPT_LENGTH, 0),
Math.min(i + EXCERPT_LENGTH, expectedHtml.length));

break;
}
Expand Down

0 comments on commit b169e7b

Please sign in to comment.