You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -63,7 +64,6 @@ test('only caches the last invocation', t => {
63
64
consthtml=
64
65
'<script type="application/ld+json">[{"@context":"http://schema.org","@type":"NewsArticle","mainEntityOfPage":"https://www.theverge.com/2017/11/16/16667366/tesla-semi-truck-announced-price-release-date-electric-self-driving","headline":"This is the Tesla Semi truck","description":"500 miles of range and more aerodynamic than a supercar","speakable":{"@type":"SpeakableSpecification","xpath":["/html/head/title","/html/head/meta[@name=\'description\']/@content"]},"datePublished":"2017-11-16T23:47:07-05:00","dateModified":"2017-11-16T23:47:07-05:00","author":{"@type":"Person","name":"Zac Estrada"},"publisher":{"@type":"Organization","name":"The Verge","logo":{"@type":"ImageObject","url":"https://cdn.vox-cdn.com/uploads/chorus_asset/file/13668586/google_amp.0.png","width":600,"height":60}},"about":{"@type":"Event","name":"Tesla Semi Truck Event 2017","startDate":"2017-11-17T04:00:00+00:00","location":{"@type":"Place","name":"Tesla Motors factory","address":"Hawthorne, California, USA"}},"image":[{"@type":"ImageObject","url":"https://cdn.vox-cdn.com/thumbor/k8ssXKPAuRwxa1pKew982ZMgv0o=/1400x1400/filters:format(jpeg)/cdn.vox-cdn.com/uploads/chorus_asset/file/9699573/Semi_Front_Profile.jpg","width":1400,"height":1400},{"@type":"ImageObject","url":"https://cdn.vox-cdn.com/thumbor/l6nkV8CkJIdUrJIzHFWUFc1zLRM=/1400x1050/filters:format(jpeg)/cdn.vox-cdn.com/uploads/chorus_asset/file/9699573/Semi_Front_Profile.jpg","width":1400,"height":1050},{"@type":"ImageObject","url":"https://cdn.vox-cdn.com/thumbor/5Sqo6J73lBi1hwzEiKCQy6FLx3I=/1400x788/filters:format(jpeg)/cdn.vox-cdn.com/uploads/chorus_asset/file/9699573/Semi_Front_Profile.jpg","width":1400,"height":788}]}]</script>'
65
66
66
-
// Load it and process it with jsonld.
67
67
const$=cheerio.load(html)
68
68
const$mutate=cheerio.load($.html())
69
69
constjson=jsonld($)
@@ -83,3 +83,17 @@ test('only caches the last invocation', t => {
83
83
// another.
84
84
t.deepEqual(json,jsonld(cheerio.load($.html())))
85
85
})
86
+
87
+
test('parse json with break lines',t=>{
88
+
const$=
89
+
cheerio.load(`<script type="application/ld+json">{"@context":"https://schema.org","mainEntity":{"description":"This is an example
90
+
🌐 of a multiline description
91
+
📬 to see how it is parsed
92
+
📧 and how it is decoded"}}</script>`)
93
+
t.snapshot(jsonld($))
94
+
})
95
+
96
+
test('returns empty array if JSON-LD is invalid',t=>{
Copy file name to clipboardExpand all lines: packages/metascraper-uol/test/snapshots/index.js.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ Generated by [AVA](https://avajs.dev).
9
9
> Snapshot 1
10
10
11
11
{
12
-
description: null,
12
+
description: 'A modelo que acusa Neymar de agressão e estupro, Najila Mendes de Souza afirmou que continuou a conversa com o jogador para ter provas do estupro.',
13
13
title: 'Modelo diz que Neymar foi “estúpido” e dá detalhes sobre suposto estupro',
0 commit comments