Test that lazy_load uses ascrape_with_js_support when requires_js_support is True.
(monkeypatch)
| 450 | |
| 451 | @pytest.mark.asyncio |
| 452 | async def test_lazy_load_with_js_support(monkeypatch): |
| 453 | """Test that lazy_load uses ascrape_with_js_support when requires_js_support is True.""" |
| 454 | urls = ["http://example.com", "http://test.com"] |
| 455 | loader = ChromiumLoader(urls, backend="playwright", requires_js_support=True) |
| 456 | |
| 457 | async def dummy_js(url): |
| 458 | return f"<html>JS content for {url}</html>" |
| 459 | |
| 460 | monkeypatch.setattr(loader, "ascrape_with_js_support", dummy_js) |
| 461 | docs = list(loader.lazy_load()) |
| 462 | assert len(docs) == 2 |
| 463 | for doc, url in zip(docs, urls): |
| 464 | assert isinstance(doc, Document) |
| 465 | assert f"JS content for {url}" in doc.page_content |
| 466 | assert doc.metadata["source"] == url |
| 467 | |
| 468 | |
| 469 | @pytest.mark.asyncio |
nothing calls this directly
no test coverage detected