import cheerio from 'cheerio'; import { assertClean } from 'test-helpers'; import HTML from './fixtures/html'; import { markToKeep } from './index'; import { KEEP_CLASS, } from './constants'; describe('markToKeep($)', () => { it('marks elements that should be kept', () => { const $ = cheerio.load(HTML.marksYouTube.before); const result = markToKeep($('*').first(), $); assertClean(result.html(), HTML.marksYouTube.after); }); it('marks same-domain elements to keep', () => { const html = '
'; const $ = cheerio.load(html); const result = markToKeep( $('*').first(), $, 'https://medium.com/foo' ); const keptHtml = ``; assertClean(result.html(), keptHtml); }); });