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.
29 lines
856 B
JavaScript
29 lines
856 B
JavaScript
import assert from 'assert';
|
|
import fs from 'fs';
|
|
|
|
import { clean } from 'test-helpers';
|
|
|
|
import GenericContentExtractor from './extractor';
|
|
|
|
describe('GenericContentExtractor', function () {
|
|
this.timeout(1000000);
|
|
describe('extract($, html, opts)', () => {
|
|
it('extracts html and returns the article', () => {
|
|
const html = fs.readFileSync('./fixtures/vulture.html', 'utf-8');
|
|
|
|
// Array.from(range(1, 100)).map((i) => {
|
|
// console.log(i)
|
|
// clean(GenericContentExtractor.extract(
|
|
// { $: null, html, url: 'http://example.com' }
|
|
// ))
|
|
// })
|
|
const result = clean(GenericContentExtractor.extract(
|
|
{ $: null, html, url: 'http://www.vulture.com/2016/08/dc-comics-greg-berlanti-c-v-r.html' }
|
|
));
|
|
|
|
assert(typeof result, 'string');
|
|
// console.log(result)
|
|
});
|
|
});
|
|
});
|