jubilee/test/euronews.scrape.js

41 lines
1.1 KiB
JavaScript

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');
test('Euronews', async t => {
t.skip('Reduce a page', 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 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();
});
t.end();
});