@@ -99,4 +99,54 @@ describe('WwwCnbcComExtractor', () => {
9999 ) ;
100100 } ) ;
101101 } ) ;
102+
103+ describe ( 'website redesign' , ( ) => {
104+ let result ;
105+ let url ;
106+ beforeAll ( ( ) => {
107+ url =
108+ 'https://www.cnbc.com/2019/03/18/heres-how-cybersecurity-vendors-drive-the-hacking-news-cycle.html' ;
109+ const html = fs . readFileSync (
110+ './fixtures/www.cnbc.com/1553160766510.html'
111+ ) ;
112+ result = Mercury . parse ( url , { html, fallback : false } ) ;
113+ } ) ;
114+
115+ it ( 'returns the title' , async ( ) => {
116+ // To pass this test, fill out the title selector
117+ // in ./src/extractors/custom/www.cnbc.com/index.js.
118+ const { title } = await result ;
119+
120+ // Update these values with the expected values from
121+ // the article.
122+ assert . equal (
123+ title ,
124+ 'Desperate to get through to executives, some cybersecurity vendors are resorting to lies and blackmail'
125+ ) ;
126+ } ) ;
127+
128+ it ( 'returns the content' , async ( ) => {
129+ // To pass this test, fill out the content selector
130+ // in ./src/extractors/custom/www.cnbc.com/index.js.
131+ // You may also want to make use of the clean and transform
132+ // options.
133+ const { content } = await result ;
134+
135+ const $ = cheerio . load ( content || '' ) ;
136+
137+ const first13 = excerptContent (
138+ $ ( '*' )
139+ . first ( )
140+ . text ( ) ,
141+ 13
142+ ) ;
143+
144+ // Update these values with the expected values from
145+ // the article.
146+ assert . equal (
147+ first13 ,
148+ 'The cybersecurity vendor marketplace is growing so crowded that some companies have been'
149+ ) ;
150+ } ) ;
151+ } ) ;
102152} ) ;
0 commit comments