fix: use htmlrewriter2 instead of HTMLRewriter for node compat (#26309)
This commit is contained in:
@@ -91,4 +91,23 @@ describe("tool.webfetch", () => {
|
||||
}),
|
||||
),
|
||||
)
|
||||
|
||||
it.instance("extracts text from html without scripts or styles", () =>
|
||||
withFetch(
|
||||
() =>
|
||||
new Response(
|
||||
"<html><head><style>.hidden{}</style><script>alert('x')</script></head><body>Hello <b>world</b></body></html>",
|
||||
{
|
||||
status: 200,
|
||||
headers: { "content-type": "text/html; charset=utf-8" },
|
||||
},
|
||||
),
|
||||
(url) =>
|
||||
Effect.gen(function* () {
|
||||
const result = yield* exec({ url: new URL("/page.html", url).toString(), format: "text" })
|
||||
expect(result.output).toBe("Hello world")
|
||||
expect(result.attachments).toBeUndefined()
|
||||
}),
|
||||
),
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user