Skip to content

Commit 8e5a603

Browse files
author
Harry
committed
feat: add unittest
1 parent 3970f79 commit 8e5a603

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<script type="application/ld+json">
6+
7+
{
8+
"@context": "http://schema.org",
9+
"@type": "NewsArticle",
10+
"thumbnailUrl": "https://uc.udn.com.tw/photo/2019/11/11/99/7053890.jpg",
11+
"keywords": "",
12+
"url": "https://money.udn.com/money/story/5635/4158094",
13+
"mainEntityOfPage": "https://money.udn.com/money/story/5635/4158094",
14+
"headline": "讓AI挑出感興趣 SparkAmplify精準行銷當紅",
15+
"articleSection": "商情", // category
16+
//"interactionCount": ""
17+
}
18+
19+
</script>
20+
</head>
21+
22+
<body></body>
23+
24+
</html>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[
2+
{
3+
"@context": "http://schema.org",
4+
"@type": "NewsArticle",
5+
"thumbnailUrl": "https://uc.udn.com.tw/photo/2019/11/11/99/7053890.jpg",
6+
"keywords": "",
7+
"url": "https://money.udn.com/money/story/5635/4158094",
8+
"mainEntityOfPage": "https://money.udn.com/money/story/5635/4158094",
9+
"headline": "讓AI挑出感興趣 SparkAmplify精準行銷當紅",
10+
"articleSection": "商情"
11+
}
12+
]

tests/test_jsonld.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ def test_jsonld_with_control_characters_comment(self):
4040
self.assertJsonLdCorrect(
4141
folder='custom.invalid',
4242
page='JSONLD_with_control_characters_comment')
43+
44+
def test_jsonld_with_json_including_js_comment(self):
45+
self.assertJsonLdCorrect(
46+
folder='custom.invalid',
47+
page='JSONLD_with_JS_comment')
4348

4449
def assertJsonLdCorrect(self, folder, page):
4550
body, expected = self._get_body_expected(folder, page)

0 commit comments

Comments
 (0)