You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mercury-parser/src/extractors/detect-by-html.test.js

25 lines
555 B
JavaScript

import assert from 'assert';
import cheerio from 'cheerio';
import detectByHtml from './detect-by-html';
describe('detectByHtml', () => {
it('detects a medium post from the html', () => {
const html =
'<head><meta name="al:ios:app_name" value="Medium" /></head>';
const $ = cheerio.load(html);
assert.equal(detectByHtml($).domain, 'medium.com');
});
it('returns nothing if no match is found', () => {
const html =
'<div></div>';
const $ = cheerio.load(html);
assert.equal(detectByHtml($), null);
});
});