jubilee/test/euronews.scrape.js

41 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-01-07 13:47:53 +00:00
const tape = require('tape');
const _test = require('tape-promise').default; // <---- notice 'default'
const test = _test(tape); // decorate tape
const fs = require('fs');
const jsonfile = require('jsonfile');
const cheerio = require('cheerio');
const { reduceArticle,reduceArticleV2 } = require('../server/reducers/euronews');
2019-01-07 13:47:53 +00:00
test('Euronews', async t => {
t.skip('Reduce a page', async t => {
const psDetail = fs.readFileSync('./data/euronews/amp-20200114.html');
2019-01-07 13:47:53 +00:00
const expectedJSON = { 'bob':false }; // jsonfile.readFileSync('tests/data/cz/ps001.json');
const output = await reduceArticle(psDetail);
t.deepEquals(output, expectedJSON, 'Extracted Details from Page');
t.end();
});
t.test('Reduce a page V2', async t => {
const psDetail = fs.readFileSync('./data/euronews/amp-20200114.html');
const expectedJSON = { 'bob':false }; // jsonfile.readFileSync('tests/data/cz/ps001.json');
const output = await reduceArticleV2(psDetail);
t.deepEquals(output, expectedJSON, 'Extracted Details from Page');
t.end();
});
2019-01-07 13:47:53 +00:00
t.end();
});