@@ -2,6 +2,8 @@ package com.chimbori.crux.articles
22
33import com.chimbori.crux.api.Fields.AMP_URL
44import com.chimbori.crux.api.Fields.BANNER_IMAGE_URL
5+ import com.chimbori.crux.api.Fields.MODIFIED_AT
6+ import com.chimbori.crux.api.Fields.PUBLISHED_AT
57import com.chimbori.crux.api.Fields.SITE_NAME
68import com.chimbori.crux.api.Fields.TITLE
79import com.chimbori.crux.common.assertContains
@@ -70,7 +72,27 @@ class GoldenFilesTest {
7072 }
7173
7274 @Test
73- fun testBBC_AMP () {
75+ fun testBBC_AMP_resourceApi () {
76+ extractFromFile(" http://www.bbc.co.uk/news/amp/37341871" .toHttpUrl(), " bbc-amp.html" ).run {
77+ assertEquals(" BBC News" , fields[SITE_NAME ])
78+ assertEquals(" Baby born on Mediterranean rescue ship" , fields[TITLE ])
79+ assertEquals(" http://www.bbc.co.uk/news/amp/37341871" .toHttpUrl(), url)
80+ assertEquals(
81+ " http://ichef.bbci.co.uk/news/999/cpsprodpb/146E6/production/_91168638_baby070012-9-20162-1photocreditalvawhitemsf.jpg" .toHttpUrl(),
82+ urls[BANNER_IMAGE_URL ]
83+ )
84+ assertStartsWith(
85+ " A Nigerian woman has given birth to a boy on board a rescue ship in the Mediterranean after being plucked from an overcrowded rubber dinghy." ,
86+ article?.text()
87+ )
88+
89+ assertEquals(" 2016-09-12T14:31:25+00:00" , fields[PUBLISHED_AT ])
90+ assertEquals(" 2016-09-12T14:31:25+00:00" , fields[MODIFIED_AT ]);
91+ }
92+ }
93+
94+ @Test
95+ fun testBBC_AMP_articleApi () {
7496 fromFile(" http://www.bbc.co.uk/news/amp/37341871" , " bbc-amp.html" ).run {
7597 assertEquals(" BBC News" , siteName)
7698 assertEquals(" Baby born on Mediterranean rescue ship" , title)
@@ -125,7 +147,19 @@ class GoldenFilesTest {
125147 }
126148
127149 @Test
128- fun testBoingBoing () {
150+ fun testBoingBoing_resourceApi () {
151+ extractFromFile(" http://www.boingboing.net/2010/08/18/dr-laura-criticism-o.html" .toHttpUrl(), " boingboing.html" ).run {
152+ assertStartsWith(
153+ " Dr. Laura: criticism of me infringes my first amendment rights Dr. Laura Schlessinger is leaving radio to regain her \" first amendment\" rights on the internet." ,
154+ article?.text()
155+ )
156+ assertEquals(" 2010-08-18T01:57:27+00:00" , fields[PUBLISHED_AT ])
157+ assertEquals(" 2010-08-18T09:43:25+00:00" , fields[MODIFIED_AT ]);
158+ }
159+ }
160+
161+ @Test
162+ fun testBoingBoing_articleApi () {
129163 fromFile(" http://www.boingboing.net/2010/08/18/dr-laura-criticism-o.html" , " boingboing.html" ).run {
130164 assertStartsWith(
131165 " Dr. Laura: criticism of me infringes my first amendment rights Dr. Laura Schlessinger is leaving radio to regain her \" first amendment\" rights on the internet." ,
@@ -1108,7 +1142,24 @@ class GoldenFilesTest {
11081142 }
11091143
11101144 @Test
1111- fun testWallStreetJournal () {
1145+ fun testWallStreetJournal_resourceApi () {
1146+ extractFromFile(" http://www.wsj.com/articles/SB10001424052748704532204575397061414483040" .toHttpUrl(), " wsj.html" ).run {
1147+ assertEquals(
1148+ " https://si.wsj.net/public/resources/images/OB-JO759_0814st_D_20100814143158.jpg" .toHttpUrl(),
1149+ urls[BANNER_IMAGE_URL ]
1150+ )
1151+ assertStartsWith(
1152+ " The Obama administration has paid out less than a third of the nearly $230 billion" ,
1153+ article?.text()
1154+ )
1155+
1156+ assertEquals(" 2010-08-14T15:14:00.000Z" , fields[PUBLISHED_AT ])
1157+ assertEquals(" 2010-08-16T04:01:00.000Z" , fields[MODIFIED_AT ]);
1158+ }
1159+ }
1160+
1161+ @Test
1162+ fun testWallStreetJournal_articleApi () {
11121163 fromFile(" http://www.wsj.com/articles/SB10001424052748704532204575397061414483040" , " wsj.html" ).run {
11131164 assertStartsWith(
11141165 " The Obama administration has paid out less than a third of the nearly $230 billion" ,
0 commit comments