Skip to content

Commit 321dc64

Browse files
wooorm42shadow42
andcommitted
Add test for performance
Related-to: syntax-tree/mdast-util-to-hast#62. Co-authored-by: Nathaniel Hunter <42shadow42@gmail.com>
1 parent 2832244 commit 321dc64

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test.js

+18
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,21 @@ test('trimLines(value)', function (t) {
1111
)
1212
t.end()
1313
})
14+
15+
test('efficiency', (t) => {
16+
const aTonOfWhitespace = 'a' + ' '.repeat(70_000) + 'b'
17+
const timeoutId = setTimeout(() => {
18+
t.fail('should process lots of whitespace efficiently')
19+
}, 10)
20+
21+
t.deepEqual(
22+
trimLines(aTonOfWhitespace),
23+
aTonOfWhitespace,
24+
'should be efficient on excessive whitespace'
25+
)
26+
27+
setTimeout(() => {
28+
clearTimeout(timeoutId)
29+
t.end()
30+
}, 0)
31+
})

0 commit comments

Comments
 (0)