22 lines
65 KiB
JavaScript
22 lines
65 KiB
JavaScript
|
|
||
|
const { reduceArticle } = require('../server/reducers/euronews');
|
||
|
|
||
|
const expect = require('expect.js');
|
||
|
|
||
|
const requestData = '<!DOCTYPE html>\n<html ⚡ class="no-js"\n lang="en" >\n<head>\n\n <meta charset="UTF-8">\n <script async src="https://cdn.ampproject.org/v0.js"></script>\n <title>What next for EU-UK trade relations? | Euronews</title>\n<meta name="description" content="Business representatives mull post-Brexit trade ties at Brussels forum, as EU prepares to publish guidelines">\n<meta name="keywords" content="Brexit,Business,Foreign trade">\n<meta name="date.created" content="2018-03-05 15:23:00">\n<meta name="date.available" content="2018-03-05 15:23:00">\n<meta name="date.updated" content="2018-03-05 15:31:20">\n<meta name="date.modified" content="2018-03-05 15:31:20">\n<meta name="program.url" content="brussels-bureau">\n<meta name="news_keywords" content="Brexit,Business,Foreign trade">\n<link rel="canonical" href="http://www.euronews.com/2018/03/05/what-next-for-eu-uk-trade-relations-"/>\n<link rel="alternate" hreflang="en" href="http://www.euronews.com/2018/03/05/what-next-for-eu-uk-trade-relations-"/>\n<link rel="alternate" hreflang="fr" href="http://fr.euronews.com/2018/03/05/le-patronat-europeen-mobilise-sur-le-brexit"/>\n<link rel="alternate" hreflang="de" href="http://de.euronews.com/2018/03/05/europas-arbeitgeber-sehen-brexit-als-wachstumsrisiko"/>\n<link rel="alternate" hreflang="es" href="http://es.euronews.com/2018/03/05/la-patronal-europea-preocupada-sobre-la-futura-relacion-entre-el-reino-unido-y-la-ue"/>\n<link rel="alternate" hreflang="pt" href="http://pt.euronews.com/2018/03/05/europebusiness-assinala-60-anos-de-existencia-com-encontro-em-bruxelas"/>\n<link rel="alternate" hreflang="tr" href="http://tr.euronews.com/2018/03/05/brexit-avrupal-isadamlar-n-endiselendiriyor"/>\n<link rel="alternate" hreflang="hu" href="http://hu.euronews.com/2018/03/05/brexit-gyors-dontest-szeretnenek-az-europai-cegek"/>\n<link rel="alternate" hreflang="x-default" href="http://www.euronews.com/2018/03/05/what-next-for-eu-uk-trade-relations-"/>\n<meta property="og:locale" content="en" />\n<meta property="og:page_id" content="101402598109" />\n<meta property="og:pages" content="101402598109" />\n<meta property="og:site_name" content="euronews" />\n<meta property="og:title" content="What next for EU-UK trade relations?" />\n<meta property="og:description" content="Business leaders are desperate to get some clarity on post-Brexit trading. And, as the EU prepares to publish draft guidelines, the economic impact has been" />\n<meta property="og:type" content="article" />\n<meta property="og:article:publisher" content="euronews" />\n<meta property="og:image:width" content="1000" />\n<meta property="og:image:height" content="563" />\n<meta property="og:image:type" content="image/jpeg" />\n<meta property="og:image" content="http://static.euronews.com/articles/stories/03/09/39/70/1000x563_story-4780d804-bb87-561b-abe5-e43f95b0877f_467635.jpg" />\n<meta property="article:published_time" content="2018-03-05 15:23:00" />\n<meta property="article:modified_time" content="2018-03-05 15:31:20" />\n<meta property="article:section" content="news_news" />\n<meta property="og:video" content="https://video.euronews.com/mp4/med/EN/EU/BX/18/03/05/en/180305_EUBX_3188896_3188953_74000_152240_en.mp4" />\n\n<meta name="twitter:site" content="@euronews" />\n<meta name="twitter:title" content="What next for EU-UK trade relations?" />\n<meta name="twitter:description" content="Business representatives mull post-Brexit trade ties at Brussels forum, as EU prepares to publish guidelines" />\n<meta name="twitter:image" content="http://static.euronews.com/articles/stories/03/09/39/70/1000x563_story-4780d804-bb87-561b-abe5-e43f95b0877f_467635.jpg" />\n<meta name="twitter:image:alt" content="What next for EU-UK trade relations?" />\n<meta name="twitter:card" content="summary_large_image" />\n<meta property="fb:pages" content="101402598109" />\n<meta name="sponsored" content="no" />\n\n <!--[if IE]>\n<meta http-equiv="X-UA-Compatible" content="IE=edge"/>\n<![endif]-->\n<link rel="apple-touch-icon" sizes="57x57" hr
|
||
|
|
||
|
const goodOutput = { 'title':'What next for EU-UK trade relations?', 'image':'http://static.euronews.com/articles/stories/03/09/39/70/1000x563_story-4780d804-bb87-561b-abe5-e43f95b0877f_467635.jpg', 'html':'\n <p>Business leaders are desperate to get some clarity on post-Brexit trading. And, as the EU prepares to publish draft guidelines, the economic impact has been the talk of the Business Europe event in Brussels.</p>\n<p>One German representative is frustrated by the uncertainty.</p>\n<p>"It will be a bit difficult to start a new agreement from scratch. If you do not use one as an example where we can add things or delete things," Dieter Kempf, President of the Federation of German Industries (BDI), told Euronews.</p>\n<p>"So my proposal be it, whatever, take Canada agreement and right off what you don't want and add what you want that is I think the only chance to come to an end in that short time-frame."</p>\n \n\n \n<h3>Stay united</h3><p>The EU's chief Brexit negotiator Michel Barnier took to the stage - and is calling on all to stand together under the cloudy Brexit sky.</p>\n<p>"Stay together to prepare together because the same issues are common to all, and stay united to preserve our common, social and economic capital which is the single market," Barnier said. </p>\n<p>The clock's ticking, with talks on future relations due to end in October.</p>\n\n \n ' };
|
||
|
|
||
|
describe('Euronews', () => {
|
||
|
|
||
|
it('should gracefully handle no data', done => {
|
||
|
expect(reduceArticle()).to.eql({});
|
||
|
done();
|
||
|
});
|
||
|
|
||
|
it('Should process data correctly', done => {
|
||
|
expect(reduceArticle(requestData)).to.eql(goodOutput);
|
||
|
done();
|
||
|
});
|
||
|
});
|