fix: timezone comparison (#222)

* fix: use format() instead of toISOString()

* fix: timezone comparison
pull/214/head
Jad Termsani 5 years ago committed by GitHub
parent 5ad02b6f28
commit 28cf41304c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,7 @@
import assert from 'assert';
import URL from 'url';
import cheerio from 'cheerio';
import moment from 'moment';
import Mercury from 'mercury';
import getExtractor from 'extractors/get-extractor';
@ -57,10 +58,11 @@ describe('MSNExtractor', () => {
// To pass this test, fill out the date_published selector
// in ./src/extractors/custom/www.msn.com/index.js.
const { date_published } = await result;
const newDatePublished = moment(date_published).format();
// Update these values with the expected values from
// the article.
assert.equal(date_published.split('T')[0], '2016-09-21');
assert.equal(newDatePublished.split('T')[0], '2016-09-21');
});
it('returns the lead_image_url', async () => {

@ -1,4 +1,5 @@
import assert from 'assert';
import moment from 'moment';
import GenericExtractor from './index';
@ -14,13 +15,14 @@ describe('GenericExtractor', () => {
html,
metaCache: [],
});
const newDatePublished = moment(date_published).format();
assert.equal(author, null);
assert.equal(
title,
'California appears poised to be first to ban power-guzzling big-screen TVs'
);
assert.equal(date_published.split('T')[0], '2009-10-14');
assert.equal(newDatePublished.split('T')[0], '2009-10-14');
assert.equal(dek, null);
});

Loading…
Cancel
Save