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/custom/nymag.com/index.test.js

22 lines
684 B
JavaScript

8 years ago
import assert from 'assert';
import Mercury from 'mercury';
const fs = require('fs');
describe('NYMagExtractor', () => {
feat: some small tweaks to toy's excellent parsers ☺️ Squashed commit of the following: commit 9638220124a325322d6cda7d16c645185d5fe827 Author: Adam Pash <adam.pash@gmail.com> Date: Mon Oct 10 11:02:29 2016 -0700 fix: removed eslint plugin that was adding unneded async parens commit ce2268c0f7c1b093c06f156730a0f1bc2aaba39c Author: Adam Pash <adam.pash@gmail.com> Date: Mon Oct 10 10:47:36 2016 -0700 style: fix async in parens commit 9591856915eddaf93170da1ce9225b8a378bdf55 Author: Adam Pash <adam.pash@gmail.com> Date: Mon Oct 10 10:37:11 2016 -0700 fix: remove parens around async commit 6c56054717acc1f7e5499691780f8273f6d07bac Author: Adam Pash <adam.pash@gmail.com> Date: Mon Oct 10 10:35:50 2016 -0700 fix msn fixture; adjusted yahoo test commit 4fc117ad5fdc5528f29b0873d60a6a1709642f15 Author: Adam Pash <adam.pash@gmail.com> Date: Mon Oct 10 10:14:38 2016 -0700 removed dek and date_publised tests; neither exist in littlethings commit 401094b4abc52901255fd2461f5839624f11d8a3 Author: Adam Pash <adam.pash@gmail.com> Date: Mon Oct 10 10:08:44 2016 -0700 feat: updated buzzfeed for content extraction commit 19548a5485f70ff9b65e3e725d2364d07734ac9c Author: Adam Pash <adam.pash@gmail.com> Date: Mon Oct 10 09:54:30 2016 -0700 fix: generator should make transforms an object, not array commit b92113f9f7c97aca9e6d3ce9243abac967d26b63 Author: Adam Pash <adam.pash@gmail.com> Date: Mon Oct 10 08:54:38 2016 -0700 feat: updated politico commit c026591040f7671cb2a6dd5177a995e21d015482 Author: Adam Pash <adam.pash@gmail.com> Date: Mon Oct 10 08:48:52 2016 -0700 fix: typos commit 14aa8fa4ce38ff1c2a212cd0225437ae3042c2c3 Author: Adam Pash <adam.pash@gmail.com> Date: Mon Oct 10 08:36:12 2016 -0700 fix: incorrect command in readme commit fe260e6122877e2cb0130a1ecde0e503017057a3 Author: Adam Pash <adam.pash@gmail.com> Date: Mon Oct 10 08:31:11 2016 -0700 fix: removed dek test because there is no dek on wikia
8 years ago
it('works with a feature story', async () => {
8 years ago
const html = fs.readFileSync('./fixtures/nymag.com/ailes.html');
const uri =
'http://nymag.com/daily/intelligencer/2016/09/how-fox-news-women-took-down-roger-ailes.html';
const { dek, title, author } = await Mercury.parse(uri, html);
const actualDek =
'How Fox News women took down the most powerful, and predatory, man in media.';
8 years ago
assert.equal(dek, actualDek);
assert.equal(title, 'The Revenge of Rogers Angels');
assert.equal(author, 'Gabriel Sherman');
});
});