Skip to content

Commit b169e7b

Browse files
committed
add excerpt length constant
1 parent fd9dc21 commit b169e7b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/helpers/helpers.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ const marked = require('../../');
22
const HtmlDiffer = require('@markedjs/html-differ').HtmlDiffer;
33
const htmlDiffer = new HtmlDiffer({ignoreSelfClosingSlash: true});
44

5+
const EXCERPT_LENGTH = 30;
6+
57
beforeEach(() => {
68
marked.setOptions(marked.getDefaults());
79

@@ -22,12 +24,12 @@ beforeEach(() => {
2224
for (var i = 0; i < expectedHtml.length; i++) {
2325
if (actualHtml[i] !== expectedHtml[i]) {
2426
actualHtml = actualHtml.substring(
25-
Math.max(i - 30, 0),
26-
Math.min(i + 30, actualHtml.length));
27+
Math.max(i - EXCERPT_LENGTH, 0),
28+
Math.min(i + EXCERPT_LENGTH, actualHtml.length));
2729

2830
expectedHtml = expectedHtml.substring(
29-
Math.max(i - 30, 0),
30-
Math.min(i + 30, expectedHtml.length));
31+
Math.max(i - EXCERPT_LENGTH, 0),
32+
Math.min(i + EXCERPT_LENGTH, expectedHtml.length));
3133

3234
break;
3335
}

0 commit comments

Comments
 (0)