diff --git a/scripts/postinstall b/scripts/postinstall index a9e155c..8ba58bb 100755 --- a/scripts/postinstall +++ b/scripts/postinstall @@ -8,6 +8,7 @@ const { writeFile } = require('fs').promises const topsites = require('top-sites') const domains = [ + [['domain', 'abc.net.au']], [['domainWithoutSuffix', 'apple']], [['domainWithoutSuffix', 'bbc']], [['domainWithoutSuffix', 'blogspot']], @@ -43,14 +44,14 @@ const domains = [ [['domainWithoutSuffix', 'theguardian']], [['domainWithoutSuffix', 'theverge']], [['domainWithoutSuffix', 'tumblr']], + [['domainWithoutSuffix', 'twitter']], [['domainWithoutSuffix', 'vimeo']], [['domainWithoutSuffix', 'wikipedia']], [['domainWithoutSuffix', 'wordpress']], [['domainWithoutSuffix', 'ycombinator']], [['domainWithoutSuffix', 'yelp']], [['domainWithoutSuffix', 'youtube']], - [['domainWithoutSuffix', 'zoom']], - [['domain', 'abc.net.au']] + [['domainWithoutSuffix', 'zoom']] ] const { top, rest } = reduce( diff --git a/test/is-fetch-mode.js b/test/is-fetch-mode.js index 5c6ab1b..35ae9e9 100644 --- a/test/is-fetch-mode.js +++ b/test/is-fetch-mode.js @@ -5,8 +5,12 @@ const test = require('ava') const { isFetchMode } = require('..') test('true', t => { - const url = - 'https://www.abc.net.au/news/2023-06-14/idpwd-2023-calling-all-budding-storytellers-with-disability/102388090' - - t.true(isFetchMode(url)) + t.true( + isFetchMode( + 'https://www.abc.net.au/news/2023-06-14/idpwd-2023-calling-all-budding-storytellers-with-disability/102388090' + ) + ) + t.false( + isFetchMode('https://twitter.com/Kikobeats/status/1741205717636264436') + ) }) diff --git a/test/prerender.js b/test/mode.js similarity index 62% rename from test/prerender.js rename to test/mode.js index e3000c3..92f1716 100644 --- a/test/prerender.js +++ b/test/mode.js @@ -20,12 +20,26 @@ test('`{ prerender: false }`', async t => { }) test("`{ prerender: 'auto' }`", async t => { - const url = 'https://google.com' - const { stats } = await getHTML(url, { - getBrowserless, - puppeteerOpts: { adblock: false } - }) - t.is(stats.mode, 'fetch') + { + const url = 'https://google.com' + const { stats } = await getHTML(url, { + getBrowserless, + puppeteerOpts: { adblock: false } + }) + t.is(stats.mode, 'fetch') + } + { + const url = 'https://twitter.com/Kikobeats/status/1741205717636264436' + const { html, stats } = await getHTML(url, { + headers: { + 'user-agent': 'Slackbot 1.0 (+https://api.slack.com/robots)' + }, + getBrowserless, + puppeteerOpts: { adblock: false } + }) + t.true(html.includes('og:description')) + t.is(stats.mode, 'fetch') + } }) test.skip('prerender error fallback into fetch mode', async t => {