jubilee/test/euronews.scrape.js

27 lines
712 B
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 } = require('../server/reducers/euronews');
test('Euronews', async t => {
t.test('Reduce a page', async t => {
const psDetail = fs.readFileSync('test/data/euronews/en002.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.end();
});