Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/metascraper-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"memoize-one": "~6.0.0",
"microsoft-capitalize": "~1.0.6",
"mime": "3",
"normalize-url": "6",
"re2": "~1.23.0",
"smartquotes": "~2.3.2",
"tldts": "~7.0.19",
Expand Down
8 changes: 7 additions & 1 deletion packages/metascraper-helpers/test/load-iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ test('wait `load` event', async t => {
t.true($iframe.html().includes('twitter:player'))
})

const normalizeTransistorAssetUrls = html =>
html.replace(
/(https:\/\/assets\.transistor\.fm\/assets\/[a-z-]+)-[a-f0-9]{64}(\.[a-z]+)/g,
'$1-[cache-busting-hash]$2'
)

test('markup is correct', async t => {
const url =
'https://saas.transistor.fm/episodes/paul-jarvis-gaining-freedom-by-building-an-indie-business'
Expand All @@ -31,5 +37,5 @@ test('markup is correct', async t => {
url,
cheerio.load(`<iframe src="${src}"></iframe>`)
)
t.snapshot($.html())
t.snapshot(normalizeTransistorAssetUrls($.html()))
})
6 changes: 3 additions & 3 deletions packages/metascraper-helpers/test/snapshots/load-iframe.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1

`<html lang="en"><head>␊
<script src="https://assets.transistor.fm/assets/embed-e2098572259f6ccaf8489b6f257566c3000015dafbd97b0d6c6749656b562c8d.js" defer="defer"></script>␊
<script src="https://assets.transistor.fm/assets/embed-[cache-busting-hash].js" defer="defer"></script>␊
<meta content="nofollow" name="robots">␊
<title>Paul Jarvis: gaining freedom by building an indie business - Audio player</title>␊
<meta content="width=device-width, initial-scale=1.0" name="viewport">␊
<link rel="icon" type="image/x-icon" href="https://assets.transistor.fm/assets/favicon-636b619b27c8932b15adac78178e70ebdf1f2c3a33de896176872b88cb3a5e48.ico">␊
<link rel="stylesheet" href="https://assets.transistor.fm/assets/embeds-d6aacdcc12f58baeb758c9afcdf0eff7c7bf3d29d154f2e22f0442cf93ccaac2.css" media="all">␊
<link rel="icon" type="image/x-icon" href="https://assets.transistor.fm/assets/favicon-[cache-busting-hash].ico">␊
<link rel="stylesheet" href="https://assets.transistor.fm/assets/embeds-[cache-busting-hash].css" media="all">␊
</head>␊
<body>␊
Expand Down
Binary file modified packages/metascraper-helpers/test/snapshots/load-iframe.js.snap
Binary file not shown.
Loading