Merge pull request #201 from omnivore-app/feature/beehiiv-newsletter-support
Support newsletters hosted on beehiiv
This commit is contained in:
15
packages/api/test/utils/data/beehiiv-newsletter.html
Normal file
15
packages/api/test/utils/data/beehiiv-newsletter.html
Normal file
File diff suppressed because one or more lines are too long
@ -22,15 +22,24 @@ describe('isProbablyNewsletter', () => {
|
||||
const html = load('./test/utils/data/substack-forwarded-welcome-email.html')
|
||||
isProbablyNewsletter(html).should.be.false
|
||||
})
|
||||
it('returns true for beehiiv.com newsletter', () => {
|
||||
const html = load('./test/utils/data/beehiiv-newsletter.html')
|
||||
isProbablyNewsletter(html).should.be.true
|
||||
})
|
||||
})
|
||||
|
||||
describe('findNewsletterUrl', async () => {
|
||||
it('gets the URL from the header if it is a newsletter', async () => {
|
||||
it('gets the URL from the header if it is a substack newsletter', async () => {
|
||||
const html = load('./test/utils/data/substack-forwarded-newsletter.html')
|
||||
const url = await findNewsletterUrl(html)
|
||||
// Not sure if the redirects from substack expire, this test could eventually fail
|
||||
expect(url).to.startWith('https://newsletter.slowchinese.net/p/companies-that-eat-people-217')
|
||||
})
|
||||
it('gets the URL from the header if it is a beehiiv newsletter', async () => {
|
||||
const html = load('./test/utils/data/beehiiv-newsletter.html')
|
||||
const url = await findNewsletterUrl(html)
|
||||
expect(url).to.startWith('https://www.milkroad.com/p/talked-guy-spent-30m-beeple')
|
||||
})
|
||||
it('returns undefined if it is not a newsletter', async () => {
|
||||
const html = load('./test/utils/data/substack-forwarded-welcome-email.html')
|
||||
const url = await findNewsletterUrl(html)
|
||||
|
||||
Reference in New Issue
Block a user