mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Rebase main
This commit is contained in:
parent
1fda6946bb
commit
706607ea2b
2 changed files with 7 additions and 7 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import { ContentHandler } from '../content-handler'
|
||||
import { parseHTML } from 'linkedom'
|
||||
|
||||
export class CooperPressHandler extends ContentHandler {
|
||||
constructor() {
|
||||
|
|
@ -22,9 +21,9 @@ export class CooperPressHandler extends ContentHandler {
|
|||
postHeader: string
|
||||
from: string
|
||||
unSubHeader: string
|
||||
html: string
|
||||
dom: Document
|
||||
}): Promise<boolean> {
|
||||
const dom = parseHTML(input.html).document
|
||||
const dom = input.dom
|
||||
return Promise.resolve(
|
||||
dom.querySelectorAll('a[href*="cooperpress.com"]').length > 0
|
||||
)
|
||||
|
|
|
|||
|
|
@ -182,9 +182,10 @@ describe('Newsletter email test', () => {
|
|||
})
|
||||
it('returns true for node-weekly newsletter', async () => {
|
||||
const html = load('./test/data/node-weekly-newsletter.html')
|
||||
const dom = parseHTML(html).document
|
||||
await expect(
|
||||
new CooperPressHandler().isNewsletter({
|
||||
html,
|
||||
dom,
|
||||
postHeader: '',
|
||||
from: '',
|
||||
unSubHeader: '',
|
||||
|
|
@ -204,9 +205,9 @@ describe('Newsletter email test', () => {
|
|||
Location:
|
||||
'https://newsletter.slowchinese.net/p/companies-that-eat-people-217',
|
||||
})
|
||||
nock('https://newsletter.slowchinese.net')
|
||||
.head('/p/companies-that-eat-people-217')
|
||||
.reply(200, '')
|
||||
nock('https://newsletter.slowchinese.net')
|
||||
.head('/p/companies-that-eat-people-217')
|
||||
.reply(200, '')
|
||||
})
|
||||
after(() => {
|
||||
nock.restore()
|
||||
|
|
|
|||
Loading…
Reference in a new issue