mirror of
https://github.com/postlight/mercury-parser
synced 2024-11-12 19:10:45 +00:00
fix: timezone comparison (#222)
* fix: use format() instead of toISOString() * fix: timezone comparison
This commit is contained in:
parent
5ad02b6f28
commit
28cf41304c
@ -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…
Reference in New Issue
Block a user