fix: timezone comparison (#222)

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

* fix: timezone comparison
This commit is contained in:
Jad Termsani 2019-01-24 12:16:31 +02:00 committed by GitHub
parent 5ad02b6f28
commit 28cf41304c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -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 () => {

View File

@ -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);
});