Skip to content

Commit

Permalink
test: update genially fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed May 19, 2024
1 parent 2f4e0b4 commit 00ca54b
Show file tree
Hide file tree
Showing 3 changed files with 357 additions and 79 deletions.
425 changes: 352 additions & 73 deletions packages/metascraper-iframe/test/fixtures/genially.html

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions packages/metascraper-iframe/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ const createMetascraper = (...args) =>
require('metascraper')([createMetascraperIframe(...args)])

test('provide `gotOpts`', async t => {
console.log('running')
const dnsCache = new CacheableLookup()
const html = await readFile(resolve(__dirname, 'fixtures/genially.html'))
const url = 'https://view.genial.ly/5dc53cfa759d2a0f4c7db5f4'
const url = 'https://view.genially.com/5dc53cfa759d2a0f4c7db5f4'
const metascraper = createMetascraper({ gotOpts: { dnsCache } })

const metadataOne = await metascraper({
Expand All @@ -26,7 +25,7 @@ test('provide `gotOpts`', async t => {
})
t.truthy(metadataOne.iframe)

t.is(dnsCache._cache.size, 2)
t.is(dnsCache._cache.size, 1)

const metadataTwo = await metascraper({
url,
Expand All @@ -35,7 +34,7 @@ test('provide `gotOpts`', async t => {
})

t.truthy(metadataTwo.iframe)
t.is(dnsCache._cache.size, 2)
t.is(dnsCache._cache.size, 1)
})

test('provide `iframe`', async t => {
Expand All @@ -55,7 +54,7 @@ commonProviders.forEach(url => {

test('get iframe from markup', async t => {
const html = await readFile(resolve(__dirname, 'fixtures/genially.html'))
const url = 'https://view.genial.ly/5dc53cfa759d2a0f4c7db5f4'
const url = 'https://view.genially.com/5dc53cfa759d2a0f4c7db5f4'
const rules = [createMetascraperIframe()]
const metascraper = createMetascraper(rules)
const metadata = await metascraper({ url, html })
Expand Down
2 changes: 1 addition & 1 deletion packages/metascraper-iframe/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test('false', t => {

test('from markup', async t => {
const html = await readFile(resolve(__dirname, 'fixtures/genially.html'))
const url = 'https://view.genial.ly/5dc53cfa759d2a0f4c7db5f4'
const url = 'https://view.genially.com/5dc53cfa759d2a0f4c7db5f4'
const htmlDom = cheerio.load(html)
t.true(validator(url, htmlDom))
})

0 comments on commit 00ca54b

Please sign in to comment.