@ -16,7 +16,7 @@ describe('NewYorkerExtractor', () => {
url =
'http://www.newyorker.com/tech/elements/hacking-cryptography-and-the-countdown-to-quantum-computing' ;
const html = fs . readFileSync (
'./fixtures/www.newyorker.com/1 475248565793 .html'
'./fixtures/www.newyorker.com/1 557138180688 .html'
) ;
result = Mercury . parse ( url , { html , fallback : false } ) ;
} ) ;
@ -61,7 +61,7 @@ describe('NewYorkerExtractor', () => {
// Update these values with the expected values from
// the article.
assert . equal ( date _published , '2016-09-26 T18:04:22.000Z ') ;
assert . equal ( date _published .split ( 'T' ) [ 0 ] , '2016-09-26 ') ;
} ) ;
it ( 'returns the lead_image_url' , async ( ) => {
@ -73,7 +73,7 @@ describe('NewYorkerExtractor', () => {
// the article.
assert . equal (
lead _image _url ,
'http ://www.newyorker.com/wp-content/uploads/2016/09/Hutchinson-Quantum-Computing-1200x630-1474903563 .jpg'
'http s://media.newyorker.com/photos/59097a5e8b51cf59fc4239f5/16:9/w_1200,h_630,c_limit/Hutchinson-Quantum-Computing .jpg'
) ;
} ) ;
@ -109,7 +109,7 @@ describe('NewYorkerExtractor', () => {
url =
'http://www.newyorker.com/magazine/2016/12/05/lessons-from-my-mother' ;
const html = fs . readFileSync (
'./fixtures/www.newyorker.com/1 480713300334 .html'
'./fixtures/www.newyorker.com/1 557145645680 .html'
) ;
result = Mercury . parse ( url , { html , fallback : false } ) ;
} ) ;
@ -126,7 +126,29 @@ describe('NewYorkerExtractor', () => {
it ( 'returns the date for magazine content' , async ( ) => {
const { date _published } = await result ;
assert . equal ( date _published , '2016-11-28T05:00:00.000Z' ) ;
assert . equal ( date _published . split ( 'T' ) [ 0 ] , '2016-11-28' ) ;
} ) ;
} ) ;
describe ( 'article with multiple authors' , ( ) => {
let result ;
let url ;
beforeAll ( ( ) => {
url =
'https://www.newyorker.com/humor/daily-shouts/teas-you-should-probably-get-rid-of-already' ;
const html = fs . readFileSync (
'./fixtures/www.newyorker.com/1557834611707.html'
) ;
result = Mercury . parse ( url , { html , fallback : false } ) ;
} ) ;
it ( 'returns multiple authors' , async ( ) => {
const { author } = await result ;
assert . equal (
author ,
'Ysabel YatesIllustration by Claire LordonMay 10, 2019'
) ;
} ) ;
} ) ;
} ) ;