import * as parser from 'node-html-parser'; import { parse } from './html'; describe('util/html', () => { it('parses HTML', () => { const body = parse('
node A'); const childNodesA = body.querySelectorAll('a'); expect(childNodesA).toHaveLength(0); }); it('parses HTML: use additional options to discover child nodes on PRE blocks', () => { const body = parse('
node A', { blockTextElements: {}, }); const childNodesA = body.querySelectorAll('a'); expect(childNodesA).toHaveLength(1); const div = childNodesA[0]; expect(div.tagName).toBe('A'); expect(div.textContent).toBe('node A'); expect(div instanceof parser.HTMLElement).toBe(true); }); });