(
html: string,
init?: {
contentType?: string
url?: string
},
)
| 5 | import { readUrl } from '../tools/read-url' |
| 6 | |
| 7 | const successValue = async ( |
| 8 | html: string, |
| 9 | init?: { |
| 10 | contentType?: string |
| 11 | url?: string |
| 12 | }, |
| 13 | ) => { |
| 14 | const fetch = async () => |
| 15 | new Response(html, { |
| 16 | status: 200, |
| 17 | headers: { |
| 18 | 'content-type': init?.contentType ?? 'text/html; charset=utf-8', |
| 19 | }, |
| 20 | }) |
| 21 | |
| 22 | const result = await readUrl({ |
| 23 | url: init?.url ?? 'https://example.com/article', |
| 24 | fetch, |
| 25 | }) |
| 26 | return result[0].value |
| 27 | } |
| 28 | |
| 29 | describe('readUrl', () => { |
| 30 | it('extracts readable HTML text beyond front-loaded boilerplate', async () => { |
no test coverage detected